|
private headers = new Headers({'Content-Type': 'application/json'});
this.http.post("http://localhost:16710/api/values/GetToken",
JSON.stringify({userName: this.UserInfo.userName,passWord: this.UserInfo.passWord}),
{headers:this.headers})
.map(res => res.json())
.subscribe(
function(data){
console.log(data);
this.navCtrl.push(TabsPage);//这里报错,提示:ERROR TypeError: Cannot read property 'push' of undefined
},function(err){ //但是把页面跳转的代码放到post外面就可以
this.UserInfo.userName='';
this.UserInfo.passWord='';
console.log('登录失败');
}
);
|
|