这里我写了angular2 url部分为
onselect(StateId: Country) {
var GetstateValue = this.http.post("http://localhost:34339/Home/GetStateById/",+StateId)
GetstateValue.subscribe(res => this.Success)
但它不是Binding StateId值(这里的id值是来的)
答案 0 :(得分:1)
获取方法:
onselect(StateId: Country) {
var GetstateValue = this.http.get("http://localhost:34339/Home/GetStateById/"+StateId)
GetstateValue.subscribe(res =>{ this.Success=res; console.log(res);)

发布方法
onselect(StateId: Country) {
const header = new Headers();
header.append('Content-Type', 'application/x-www-form-urlencoded');
let data = StateId;
var GetstateValue = this.http.post("http://localhost:34339/Home/GetStateById/", data, {headers: header}).map(res=>res.json());
GetstateValue.subscribe(res => this.Success);