Hello I am struggling to redirect the landing page after successful login to ionic3 apps. It always shows error: ERROR TypeError: "this.navCtrl is undefined"
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');
}
}
});
my constructor:
constructor(public navCtrl: NavController,
public navParams: NavParams,
private formBuilder: FormBuilder,
private menu: MenuController) {
this.menu.enable(true); // Enable sidemenu
}