2016-09-16 56 views
1

Im 將我的angular2應用程序升級到RC5,現在Http.delete操作失敗(在它執行之前),當它成功之前。Angular2 - RC5 Http.delete失敗

這裏的package.json: "@angular/common": "2.0.0-rc.5", "@angular/compiler": "2.0.0-rc.5", "@angular/core": "2.0.0-rc.5", "@angular/http": "2.0.0-rc.5", "@angular/forms": "0.3.0", "@angular/platform-browser": "2.0.0-rc.5", "@angular/platform-browser-dynamic": "2.0.0-rc.5", "@angular/router": "3.0.0-rc.1", "@angular/router-deprecated": "2.0.0-rc.2", "@angular/upgrade": "2.0.0-rc.5",

下面是即時通訊使用它:

deleteUser(id){ 
    let headers = new Headers({ 'Content-Type': 'application/json'}); 
    let options = new RequestOptions({ headers: headers }); 
    return this.http.delete(this._usersUrl + '/' + id, options) 
     .map(res => { 
      return <User>res.json() 
     }) 
     .catch(this.handleError) 
} 

在調試,我可以看到它得到直到http.delete在執行刪除操作崩潰(DELETE不發送到服務器)。我檢查了docs for Http api以防我遺漏了一些論點,但我認爲他們沒有問題。

檢查更仔細,沒有執行刪除操作,但其他HTTP操作正常工作。任何線索?

我得到的錯誤是:

platform-browser.umd.min.js:6 ORIGINAL EXCEPTION: TypeError: Cannot read property 'toString' of nullBrowserDomAdapter.logError @ platform-browser.umd.min.js:6ExceptionHandler.call @ core.umd.min.js:7next @ core.umd.min.js:10generatorOrNext.object.schedulerFn @ core.umd.min.js:10t.__tryOrUnsub @ Rx.min.js?cb=e6b3f62:11t.next @ Rx.min.js?cb=e6b3f62:11t._next @ Rx.min.js?cb=e6b3f62:11t.next @ Rx.min.js?cb=e6b3f62:11t._finalNext @ Rx.min.js?cb=e6b3f62:11t._next @ Rx.min.js?cb=e6b3f62:11t.next @ Rx.min.js?cb=e6b3f62:11EventEmitter.emit @ core.umd.min.js:10onError @ core.umd.min.js:10onHandleError @ core.umd.min.js:10e.handleError @ zone.min.js?cb=e6b3f62:1e.runGuarded @ zone.min.js?cb=e6b3f62:1NgZoneImpl.runInnerGuarded @ core.umd.min.js:10NgZone.runGuarded @ core.umd.min.js:10outsideHandler @ platform-browser.umd.min.js:7e.invokeTask @ zone.min.js?cb=e6b3f62:1e.runTask @ zone.min.js?cb=e6b3f62:1invoke @ zone.min.js?cb=e6b3f62:1 platform-browser.umd.min.js:6 ORIGINAL STACKTRACE:BrowserDomAdapter.logError @ platform-browser.umd.min.js:6ExceptionHandler.call @ core.umd.min.js:7next @ core.umd.min.js:10generatorOrNext.object.schedulerFn @ core.umd.min.js:10t.__tryOrUnsub @ Rx.min.js?cb=e6b3f62:11t.next @ Rx.min.js?cb=e6b3f62:11t._next @ Rx.min.js?cb=e6b3f62:11t.next @ Rx.min.js?cb=e6b3f62:11t._finalNext @ Rx.min.js?cb=e6b3f62:11t._next @ Rx.min.js?cb=e6b3f62:11t.next @ Rx.min.js?cb=e6b3f62:11EventEmitter.emit @ core.umd.min.js:10onError @ core.umd.min.js:10onHandleError @ core.umd.min.js:10e.handleError @ zone.min.js?cb=e6b3f62:1e.runGuarded @ zone.min.js?cb=e6b3f62:1NgZoneImpl.runInnerGuarded @ core.umd.min.js:10NgZone.runGuarded @ core.umd.min.js:10outsideHandler @ platform-browser.umd.min.js:7e.invokeTask @ zone.min.js?cb=e6b3f62:1e.runTask @ zone.min.js?cb=e6b3f62:1invoke @ zone.min.js?cb=e6b3f62:1 platform-browser.umd.min.js:6 TypeError: Cannot read property 'toString' of null at Request.Body.text (http.umd.min.js:6) at Request.getBody (http.umd.min.js:7) at eval [as _subscribe] (http.umd.min.js:6) at e.subscribe (Rx.min.js?cb=e6b3f62:11) at e._subscribe (Rx.min.js?cb=e6b3f62:11) at e.call (Rx.min.js?cb=e6b3f62:7)

回答

-2

角度2.0發佈試試你的代碼升級到穩定版本。