您好,我在成功登录至ionic3应用程序后仍在努力重定向登录页面。它总是显示错误:ERROR TypeError:“ this.navCtrl未定义”
doLogin(){
$.ajax({
type: 'get',
url: 'http://my_server_ip_address/php/login.php?u='+this.UserInfoForm.username+'&p='+this.UserInfoForm.password,
success: function (res) {
window.localStorage['userInfo'] = JSON.stringify(res);
this.navCtrl.setRoot('clientDashboard');
},
error:function(){
this.navCtrl.setRoot('LoginPage');
}
}
});
我的构造函数:
constructor(public navCtrl: NavController,
public navParams: NavParams,
private formBuilder: FormBuilder,
private menu: MenuController) {
this.menu.enable(true); // Enable sidemenu
}