I'm having some issues grokking how Angular UI Router nested views work.
My $stateProvider looks like this:
$stateProvider
.state('login', {
url: "/login",
views: {
'main': {
templateUrl: "static/templates/login.html",
controller: 'LoginCtrl'
}
}
})
.state('dashboard', {
url: "/dashboard",
controller: 'DashboardCtrl',
views: {
'main': {
templateUrl: "static/templates/dashboard.html",
},
'content' : {
templateUrl: 'static/templates/partials/dashboard-content.html',
controller: 'DashboardContentCtrl'
}
}
});
My goal here is to load in the 'dashboard.html' template dynamically (this works). But after that, populate the 'content' ui-view with 'dashboard-content.html'.
dashboard.html
<div class="span3">
<!-- A bunch of plain html -->
</div>
<div class="span9" ui-view='content'></div>
My index file (that loads the whole app) has a ui-view named "main", which seems to be working fine. I need this to work because 'dashboard-content.html' contains menu items that will need to be available across the logged in site. Only items in the 'content' ui-view will be changing significantly. Anything else will just have something simple like an 'active' class applied to a link.
Just use absolute naming in the second view def:
The doc reference (and a small cite from it):
View Names - Relative vs. Absolute Names
For example, the previous example could also be written as:
You can also check this for more explanation and working plunker