Reputation: 6922
I have the following set up:
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'});
}]);
When I go to localhost/#/user the groupListController is activated. When I go to localhost/#/group the groupListController is activated but it uses the userlist.html partial template.
Why isn't it using the proper controller? Am I fundamentally using routing and templates improperly?
(side note, I have mod_rewrite taking rewriting the blank path to index.html)
Upvotes: 1
Views: 1211
Reputation: 20492
Probably there is an error where the controllers are defined.
It seems you have something like:
userSystemApp.controller('userListController', theFunction);
But theFunction
instead of being the correct one, which returns the userListController
, is by mistake the one which defines the groupListController
.
Upvotes: 1