I store certain information in SqlStorage. When I attempt to retrive that information I get a promise:
export class ProfileService {
this.storage = new Storage(sqlStorage);
get fname() {
this.storage.get('fname');
}
...
..
}
Now when displaying user’s profile, I need to display information from profile service:
@Page({
...
})
export class DisplayProfile {
fname: AbstractControl;
constructor(private _profile: ProfileService) {
// SEE HERE
this._profile.get('fname').then(value => {
this.fname.value = value;
});
this._profile.get('lname').then(value=>{
...
});
}
}
As you can see above, I am resolving promises in the contructor of the Page. I rather have these promises resolved before page load (just like resolve blocks in Angular1 state change).
Any clue how I can achieve this ?