-
Notifications
You must be signed in to change notification settings - Fork 0
ng ui router
hogino edited this page Feb 20, 2015
·
3 revisions
https://github.com/angular-ui/ui-router
ng-viewはmultiviewに対応していないので、ui routerを使用する。
- jsからのステート遷移
$state.transitionTo('state')
$state.go('state', {params: 'data'})
- controller間の値参照
resolve: {
contacts: ['contacts',
function( contacts){
return contacts.all();
}]
}
$stateProvider
.state('contacts', {})
.state('contacts.list', {});
angular.module('myApp', ['ui.router', 'ui.router.stateHelper'])
.config(function(stateHelperProvider){
stateHelperProvider.setNestedState({
name: 'root',
templateUrl: 'root.html',
children: [
{
name: 'contacts',
templateUrl: 'contacts.html',
children: [
{
name: 'list',
templateUrl: 'contacts.list.html'
}
]
},
{
name: 'products',
templateUrl: 'products.html',
children: [
{
name: 'list',
templateUrl: 'products.list.html'
}
]
}
]
});
});