2016-08-18 93 views
2
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) } 
     ); 
} 

我得到這個錯誤:this.http.post(...)地圖是不是一個函數

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(…) 

缺什麼在我的HTTP語法?

回答

3

您需要導入rxjs像

import 'rxjs/Rx'; 
+1

我有這個已經,但我看到這個錯誤 –