I have a login screen as my Root page in my Ionic 2 RC0 app. Once the username and password are validated I am setting HomePage as my Root page in the app. I see in the log the constructor of the page is getting called but the screen is coming as blank. Below is the code:
WelcomePage.ts
@Component({
templateUrl: 'welcome.html',
})
export class WelcomePage {
constructor(public nav: NavController,
public loginService : LoginService,
public labelAndAlerts : AppLabelsAndMessages,
public globalConstants : GlobalConstants,
public util : UtilityService) {
console.log('--> inside WelcomePage');
}
public openNextPage(){
console.log('--> WelcomePage:openNextPage called');
this.nav.setRoot(HomePage).then(data => {
console.log('right',data);
}, (error) => {
console.log('error',error);
});
}
requestLogin(username,password){
//Validate username
if(username.value == this.globalConstants.blankString || username.value.trim() == this.globalConstants.blankString){
this.util.showAlert(this.labelAndAlerts.ALERT_USERNAME_MENDATORY);
return false;
}
//Validate password
if(password.value == this.globalConstants.blankString || password.value.trim() == this.globalConstants.blankString){
this.util.showAlert(this.labelAndAlerts.ALERT_PASSWORD_MENDATORY);
return false;
}
//this.util.showProgressBar();
let data = {"username" : username.value, "password" : password.value};
if(!this.loginService.isChallenged){
WLAuthorizationManager.login(this.globalConstants.securityCheckName, data).then(
() => {//success handler
this.util.hideProgressBar();
this.openNextPage();
},
() => {//failure handler
//this.util.hideProgressBar();
this.util.showAlert(this.labelAndAlerts.ALERT_ERR_REQUEST_PROCESSING_FAILED);
}
);
}else{
this.loginService.authHandler.submitChallengeAnswer(data);
this.loginService.isChallenged = false;
}
}
}
HomePage.ts
@Component({
template : 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
constructor() {
console.log('--> HomePage init called');
}
}
There is no error coming on the console. Is there something wrong with the code?