Runtime Error After Handling 400
Scenario: The username and password is authenticated using WebApi 2 token authentication. If the credentials are correct, then token is returned. But, if the credentials are incorr
Solution 1:
LoadingController can only be called once.
Note that after the component is dismissed, it will not be usable anymore and another one must be created.
This is causing the exception.
You should create new loading everytime in doLogin
.
doLogin() {
if (this.Username !== undefined && this.Password !== undefined) {
this.loading = this.loadingCtrl.create({ //create here
content: 'Please wait...'
});
this.loading.present();
this.authSrv.login(this.Username, this.Password).subscribe(data => {
this.navCtrl.setRoot('HomePage');
this.loading.dismiss();
}, (err) => {
this.errorMsg("Invalid Username/Password !" + err);
this.loading.dismiss();
});
}
elsethis.errorMsg("Please enter Username/Password");
}
Post a Comment for "Runtime Error After Handling 400"