将AngularJS $ http请求转换为Angular2 POST

时间:2017-03-10 22:37:04

标签: angularjs http angular post request

我有以下Angular 1.5 $ http请求:

 this.$http({
    method: 'POST',
    url: "example.com",
    data: {
        "action" : "myAction"
    },
    headers: {'Content-Type': 'application/x-www-form-urlencoded'},
    transformRequest: function(obj) {...}
});

我试图将其重写为Angular2,但我不知道"数据"和" transformRequest"属性翻译。到目前为止,我有:

let options = new RequestOptions({
        method: RequestMethod.Post,
        headers: myHeader
});
this.http.post(
        'example.com',
        options
);

如何添加Angular2等效的"数据"和" transformRequest"?

0 个答案:

没有答案