1

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)

2
  • "When I go to localhost/#/user the groupListController is activated" did you mean the userListController is loaded? Commented Oct 12, 2013 at 2:43
  • No, that's why I'm confused. When I look at the network tab on firebug it calls the service that the groupListController calls. Commented Oct 12, 2013 at 2:53

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Close enough. It turns out I didn't give you enough information. In the service definition I accidentally named the Group service User. Stare at this stuff too long you go blind.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.