小编Man*_*har的帖子

如何基于打字稿中的键对对象数组进行排序

我有一个具有属性的候选对象

candidateid:number;
name:string;
Run Code Online (Sandbox Code Playgroud)

我希望根据name属性对这些对象进行排序.如何在角度2中的TypeScript中实现此目的?

javascript typescript angular

28
推荐指数
1
解决办法
3万
查看次数

将json对象数据转换为x-www-form-urlencoded

我希望将json对象转换为x-www-form-urlencoded如何在角度2最终版本中实现此目的

export class Compentency {
  competencies : number[];
}
postData() {
        let array =  [1, 2, 3];
        this.comp.competencies = array;
        let  headers = new Headers({ 'Content-Type': 'application/x-www-form-urlencoded' });
        let options = new RequestOptions({ headers: headers, method: 'post' });
        return this.http.post(this.postUrl, JSON.stringify(this.comp), options)
        .map(res => res.json().data.competencies)
        .catch(this.handleError);
    }
Run Code Online (Sandbox Code Playgroud)

typescript angular

6
推荐指数
3
解决办法
6876
查看次数

标签 统计

angular ×2

typescript ×2

javascript ×1