我有以下设置:
var userSystemApp = angular.module("userSystem",['userServices','groupServices']).
config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
$routeProvider.
when('/user', {templateUrl: 'user/partials/userlist.html', controller: 'userListController'}).
when('/user/:userName', {templateUrl: 'user/partials/userdetail.html', controller: 'userDetailController'}).
when('/group',{templateUrl: 'group/partials/grouplist.html', controller: 'groupListController'}).
when('/group/:groupName', {templateUrl: 'group/partials/groupDetail.html', controller: 'groupDetailController'}).
otherwise({redirectTo: '/user'});
}]);
当我转到 localhost/#/user 时, groupListController 被激活。当我转到 localhost/#/group 时, groupListController 被激活,但它使用 userlist.html 部分模板。
为什么不使用正确的控制器?我是否从根本上不正确地使用路由和模板?
(旁注,我有 mod_rewrite 重写 index.html 的空白路径)