Issues traversing views in Ionic and AngularJS

I’m having a hard time understanding how different views are handled in Ionic and Angular. I have the following code:

.config(function($stateProvider, $urlRouterProvider) {
  $stateProvider

    .state('index', {
      url: "/",
      templateURL: "templates/menu.html"
    });

});

With my understanding this should inject the code from menu.html into the ion-nav-view tags in index.html at run-time. However, when the page is loaded, it simply displays index.html with no injected code.



I have been unable to find specific instructions on each property of state, making a possible error in my code hard to decipher. I also have found that state may be deprecated by the latest version of Angular, but Ionic docs explain to use state so that is what I have been trying to do. Any clarification or resources would be greatly appreciated.

Actually this “state” thing is not a part of AngularJS, it is a apart of Angular UI-Router, a framework that support AngularJS, check here.


No page compiled in the ion-nav-view tags may be caused by lots of reasons, you may check the console for errors. Mostly possibly problem may be solved adding following code.

$urlRouterProvider.otherwise("/");

Hope this helps.

It was that and my templateURL casing. It needs to be templateUrl. Thank you!