When i read value from constructor third time give error.
Uncaught (in promise): TypeError: Cannot read property ‘name’ of null TypeError: Cannot read property ‘name’ of null at
Following is my code.
constructor(public navCtrl: NavController, public navParams: NavParams,
public loadingCtrl: LoadingController,
private serviceListService: ServiceListService,
public storage: Storage,
public modalCtrl: ModalController
) {
// Get UserId Value From Storage
storage.get('UserId').then((val) => {
alert(val);
if (val != null && val != "") {
let modal = this.modalCtrl.create(ModalChangeCityPage);
modal.present();
} else {
let modal = this.modalCtrl.create(ModalRegisterUserPage);
modal.present();
}
})
}