I’m using the nav.setRoot method after login to clear the nav stack and nav to the correct starting page, and everything works dandy, except for one thing… the margin-top and margin-bottom element styles on the scroll-content are missing. If I nav to another page and back the margins reappear. Any thoughts?
from app.component:
this.events.subscribe('user:authenticated', () =>{
console.log('detected event -- user:authenticated');
// setRoot clears the nav, so there is no back button or page history
this.nav.setRoot(TabsPage);
})
from auth.service:
this.lock.on('authenticated', authResult => {
console.log('authentication successful, set token to local storage');
this.storage.set('id_token', authResult.idToken);
this.idToken = authResult.idToken;
this.refreshToken = authResult.refreshToken;
console.log('stored id, refresh', this.idToken, this.refreshToken);
// Fetch profile information
console.log('get profile');
this.lock.getProfile(authResult.idToken, (error, profile) => {
if (error) {
// Handle error
alert(error);
return;
}
profile.user_metadata = profile.user_metadata || {};
this.storage.set('profile', JSON.stringify(profile));
console.log('set profile', profile);
this.user = profile;
// extraneous
this.userString = JSON.stringify(profile);
// set UserData to logged in
this.userData.login(this.user['nickname']);
// for some reason, it is necessary to wrap the event publication
// in a timeout, otherwise rivalsAuth fails
setTimeout(()=> this.events.publish('user:authenticated', 'lock'));
});
this.lock.hide();
this.storage.set('refresh_token', authResult.refreshToken);
this.zoneImpl.run(() => this.user = authResult.profile);
console.log('finally, call scheduleRefresh()');
// Schedule a token refresh
this.scheduleRefresh();
});
Marc