2017-05-11 47 views
0

这里使用angular2在服务器端,当我尝试插入从客户端到服务器的值的数据IM是不是在服务器端Angular2数据为什么没有在服务器端绑定

state.ts

export class State { 
    Sts_Id: number; 
    Sts_Name: string; 
    Cnt_Id: number; 

} 
    StateObj: State = new State() 
    StateArray: Array<State> = new Array<State>(); 
     SaveState(saveState: State) { 
        let headers = new Headers({ 'Content-Type': 'application/json; charset=utf-8'}); 
       let options = new RequestOptions({ headers: headers}); 
       var GetstateValue = this.http.post("http://localhost:34339/Home/StatePost" + '/' + saveState, options); 
       GetstateValue.subscribe((res => this.Success(res)), res => this.Error(res)); 
       console.log(GetstateValue); 

      } 

回答

0

结合试试这个:

export class State { 
    Sts_Id: number; 
    Sts_Name: string; 
    Cnt_Id: number; 

} 
    StateObj: State = new State() 
    StateArray: Array<State> = new Array<State>(); 
     SaveState(saveState: State) { 
        let headers = new Headers({ 'Content-Type': 'application/json; charset=utf-8'}); 
       let options = new RequestOptions({ headers: headers}); 
       var GetstateValue = this.http.post("http://localhost:34339/Home/StatePost",{saveState}, options); 
       GetstateValue.subscribe((res => this.Success(res)), res => this.Error(res)); 
       console.log(GetstateValue); 

      } 
相关问题