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.
I'm unsure if this is even worthy of an answer, but, in case someone else has a similar issue.
Ionic uses ui-router
, a framework that replaces ngRoute. My specific issue was that I was missing the line $urlRouterProvider.otherwise("/")
, which serves as a default route. I also used the incorrect casing on templateURL
, it was supposed to be templateUrl
. Perhaps someone can learn from my silly mistake.