我正在开发一个有角度的应用程序,我正在努力实现以下路线:
/networks
/network/nameofnetwork
/network/nameofnetwork/shows
/network/nameofnetwork/show/nameofshow
我的问题是我可以访问所有路由,但是被调用的唯一状态参数是网络名称而不是节目。继承我的模块:
angular.module('network',[])
.config(['$stateProvider',function($stateProvider){
$stateProvider
.state('networks',{
url: '/networks',
templateUrl:'/templates/network/networks.tpl.html',
controller: 'ViewNetworksCtrl'
})
.state('network',{
url: '/network/:username',
templateUrl:'/templates/network/network.tpl.html',
controller: 'ViewNetworkCtrl'
})
.state('network.schedule',{
url: '/schedule',
templateUrl:'/templates/network/schedule.tpl.html',
controller: 'NetworkScheduleCtrl'
})
.state('network.shows',{
url: '/shows',
templateUrl:'/templates/network/shows.tpl.html',
controller: 'NetworkShowsCtrl'
})
.state('network.show',{
url: '/show/:slug',
templateUrl:'/templates/network/show.tpl.html',
controller: 'NetworkShowCtrl'
});
}])
.controller('ViewNetworksCtrl',['$scope',function($scope){}])
.controller('ViewNetworkCtrl',['$scope','$stateParams',function($scope, $stateParams){
console.log($stateParams);
}])
.controller('NetworkScheduleCtrl',['$scope',function($scope){}])
.controller('NetworkShowsCtrl',['$scope',function($scope){}])
.controller('NetworkShowCtrl',['$scope','$stateParams',function($scope, $stateParams){
console.log($stateParams);
}]);
答案 0 :(得分:0)
通过在IRC频道聊天,我发现我错过了一个嵌套的