此.http.post(…).map不是函数
我得到这个错误:此.http.post(…).map不是函数,http,angular,Http,Angular,我得到这个错误: doSelectMessagesAttributesUrl1(pushRequest : PushRequest) { console.info("sending post request"); let headers = new Headers({ 'Content-Type': 'application/x-www-form-urlencoded'}); return this.http .post(this.se
doSelectMessagesAttributesUrl1(pushRequest : PushRequest) {
console.info("sending post request");
let headers = new Headers({
'Content-Type': 'application/x-www-form-urlencoded'});
return this.http
.post(this.selectMessagesAttributesUrl, {headers: headers})
.map(res => res.json().data)
.subscribe(
data => { },
err => { console.error('An error occurred', err) }
);
}
异常:TypeError:this.http.post(…).map不是functionBrowserDomAdapter.logError@platform browser.umd.js:937
zone.js:461
未处理的承诺拒绝:this.http.post(…).map不是函数;区域:;任务:承诺;Value:TypeError:this.http.post(…).map不是函数(…)
我的http语法缺少什么?您需要像
EXCEPTION: TypeError: this.http.post(...).map is not a functionBrowserDomAdapter.logError @ platform-browser.umd.js:937
zone.js:461
Unhandled Promise rejection: this.http.post(...).map is not a function ; Zone: <root> ; Task: Promise.then ; Value: TypeError: this.http.post(...).map is not a function(…)
我已经有了,但是我看到了这个错误。请注意,导入的使用将大幅增加捆绑包的大小//-----------map-----------------import'rxjs/add/operator/map';从“rxjs/operators”导入{map};进口“rxjs/Rx”;从“rxjs”导入{Observable};导入“rxjs/add/observable/throw”;
import 'rxjs/Rx';