Since updating npm to newest version, I have tried to maintain Angular 1.5.1, UI-Router 0.2.18 but it seems that nothing is rendering.
I need a layout where a top ui-view, nav, remains across several pages (eg, states). The page has a path variable containing the name of the state handed to it, which is the .run function attached.
Code (in .coffee)
angular.module('xxx', ['ui.router'])
.config([
'$stateProvider',
'$urlRouterProvider',
'$locationProvider',
'$sceProvider',
($stateProvider, $urlRouterProvider, $locationProvider, $sceProvider) ->
$sceProvider.enabled(false)
$urlRouterProvider.otherwise('/')
query = {
name: 'query',
url: '/query',
views: {
'nav@': {
templateUrl: 'nav/nav.html'
},
'main@query': {
templateUrl: 'query/query.html'
},
'builder@query': {
templateUrl: 'query/query-builder.html'
},
'result@query': {
templateUrl: 'query/query-result.html'
}
}
}
$stateProvider.state(query)
for r in ["a", "b", "c", "d", "e"]
query2 = {
name: r,
url: r,
views: {
'nav': {
templateUrl: 'nav/nav.html'
}
}
}
$stateProvider.state(query2)
])
.run([
'$rootScope',
'$state',
'$window',
'$timeout',
($rootScope, $state, $window, $timeout) ->
path = $window.path
if path
$state.transitionTo(path)
])
And related template files:
<ng-app="xxx">
<!-- Main base.html-->
<div ui-view="nav">
<!-- Specific query page -->
<div ui-view="main">
<!-- Within query page, nested ui-views -->
<div ui-view="builder"></div>
<div ui-view="result"></div>
Any thoughts?
As loading views nested to components and application, parent components will not load again in the below example the header. So the nav, remains across several pages.
Hope this is helpful.