Reputation: 4161
I have to implement a two screen registration, after 1st time I register - I want to disable ui-router state, that even if the application is shutdown or restarted, It will preserve the same condition. I have two pages that I have to implement the same logic.
The problem is - that I'm not capable to intervene between the: $urlRouterProvider.otherwise('sign-in');
and the application.
How can I disable programmatically any state I want.
Upvotes: 0
Views: 89
Reputation: 57907
If you're using LocalStorage, store the state you want to go to when the app starts. Set this in your controller for when they've successfully accomplished whatever task that determines that they shouldn't see the first screen again:
var userState = $state.current.name;
$window.localstorage.setItem('startupState', userState);
And then on App load:
$ionicPlatform.ready(function() {
var startupState = $window.localstorage.getItem('startupState') || '';
if (startupState.length > 0) {
$state.transitionTo(startupState);
}
});
Upvotes: 1