I have this index.html:
<body ng-controller="MainCtrl">
<div class="app" ui-view>
<h1>This should be visible while the app loads</h1>
</div>
</body>
My config code:
angular.module('app').config(function ($locationProvider, $stateProvider) {
$locationProvider.html5Mode(true);
$stateProvider
.state('login', {
url: '/login',
templateUrl: '/res/login/login.tpl.html'
})
.state('app', {
url: '/',
templateUrl: '/res/app/app.tpl.html',
controller: 'AppCtrl',
abstract: true,
views:{
header: {
templateUrl: '/res/app/header.tpl.html'
},
toolbox: {
templateUrl: '/res/app/toolbox.tpl.html'
}
}
})
.state('app.online', {
url: 'online',
templateUrl: '/res/app/online/online.tpl.html'
})
.state('app.history', {
url: 'history',
templateUrl: '/res/app/history/history.tpl.html'
});
})
.controller('MainCtrl', ['$state', function ($state) {
}])
.controller('LoginCtrl', [function () {
}])
.controller('AppCtrl', [function () {
}])
.controller('HeaderCtrl', [function () {
}])
.controller('SidebarCtrl', [function () {
}]);
app.tpl.html:
<div class="header" ui-view="header"></div>
<div class="content">
<div class="toolbox" ui-view="toolbox"></div>
<div class="content" ui-view>
Place for the states - "app.online" and "app.history"
</div>
</div>
I want the following to happen:
- It should have two main states - Login and App.
- The App state should contain three sub-views: header, toolbox and content. The "content" view is a container for the views of sub-states app.online and app.history.
- After getting into App state, I want the user to navigate between the sub-states app.online and app.history. The App state should be abstract and the default sub-state should be app.online
URLs:
/login[login state with single view]/[app state, which should redirect to /online]/online[app.online state]/history[app.history state]
Currently, I can load /login successfully, but I don't understand why going to /online doesn't display app.tpl.html.
What am I missing?