angular-ui-router 中的三层嵌套路由 [英] Three level nested routes in angular-ui-router
本文介绍了angular-ui-router 中的三层嵌套路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图让我的嵌套路由正常工作,但现在这两天让我很难过:(
Im trying to get my nested route working but it's giving me hard time for two days now :(
一级工作正常
两个级别都很好
三个级别不起作用!
有人可以帮我吗?
提前致谢
angular.module('settings', []).config(['$stateProvider', '$routeProvider', '$urlRouterProvider', function($stateProvider, $routeProvider, $urlRouterProvider) {
$stateProvider
.state('settings', {
url: '/settings',
template:"Settings",
controller: function(){
console.log('settings');
}
}).
state('settings.branch', {
url: '/{branchId:[0-9]{1,8}}',
template:"Branch",
controller: function(){
console.log('branch');
}
}).
state('settings.branch.prop', {
url: '/prop',
template:"Property",
controller: function(){
console.log('property');
}
});
}]);
'/settings' 正在运行
'/settings' is working
'/settings/1234' 正在工作
'/settings/1234' is working
'/settings/1234/prop' 不起作用,总是返回 prevues 状态 'Branch'
'/settings/1234/prop' is not working, always return the prevues state 'Branch'
推荐答案
我猜你没有在 Branch 模板中声明 ui-view
I guess you didn't declare an ui-view in the Branch template
这篇关于angular-ui-router 中的三层嵌套路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文