Question

Looking at the ui-router sample starting it I see that url:

http://angular-ui.github.io/ui-router/sample/#/

When I change the state:

 .state("home", {

          // Use a url of "/" to set a states as the "index".
          url: "/"

to this:

 .state("home", {

          // Use a url of "/" to set a states as the "index".
          url: "/home",

I see this when I explicitly click on the home button:

http://angular-ui.github.io/ui-router/sample/#/home

But when I initially load the demo app I see this:

http://angular-ui.github.io/ui-router/sample/#/

Why does the loading of the default route not show #/home but #/ ?

But the default url is 'fixed' when I click the home button ?

I also want to see initially #/home

Was it helpful?

Solution

You need to set otherwise option for $urlRouterProvider like this:

app.config(function ($stateProvider, $urlRouterProvider, $injector) {
  $urlRouterProvider.otherwise('/home');
  $stateProvider.state('home', {

this will allow you to set default state other than /.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top