Organizational Research By

Surprising Reserch Topic

Experts Most Trusted Topic


is it possible to set initial state and otherwise state using ui router


is it possible to set initial state and otherwise state using ui router  using -'angularjs,angular-ui-router'

I'm setting the initial state when first entering the app with a simple condition (i'm fully aware it also prevents deep linking .. thats OK).

.run(function($state, browserFactory) {

    if (browserFactory.isSupported()) {
        $state.go('browser-unsupported');
    } else {
        $state.go('welcome');
    }
}


This is working fine.

But, if I set an otherwise rule it will always follow that rule. For example, if I set

.config(function($urlRouterProvider) {
    $urlRouterProvider.otherwise('/welcome');
}


It will always end up at /welcome.

Is there any way around it or maybe a better way to set an initial route based on a condition and have an otherwise rule?
    

asked Oct 13, 2015 by dahiyabecomp
0 votes
1 view



Related Hot Questions



Walkin Jobs Opening



Government Jobs Opening


...