2017-06-01 58 views
0

我試着發送參數到我的節點服務器,我得到這樣的錯誤「未捕獲(承諾):錯誤:沒有提供程序的Http!錯誤:沒有提供程序的Http!在injectionError」我Http Post方法在離子2

let postParams = { 
    name: "RAJ", 
    username: "RAJ", 
    email: "RAJ", 
    pass: "RAJ" 
} 

this.http.post("http://localhost:8080/users", postParams, options) 
    .catch(error => console.log(error)) 
    .subscribe(data => console.log(data['_body'])); 
+0

多一點信息將幫助 - 你的進口,裝飾的相關部分,也是相關組件的版本(從的package.json)。 – brianlmerritt

回答

0

添加HttpModule你的模塊,

import { HttpModule } from '@angular/http'; 

@NgModule({ 
    imports: [ BrowserModule, HttpModule]  
}) 
+0

即時通訊使用角2我認爲..其顯示NgModule未定義 – RajaSekar