$routeProvider
            .when('/default', {
                templateUrl: 'HTML/login.html',
                controller : 'funct2'
            }).when('/adminMenu/:username', {
                templateUrl: 'HTML/adminMenu.html',
                controller : 'admin'
            }).otherwise({
                redirectTo : '/default'
            });

When i try to use the controller adminMenu i get a no adminMenu defined even though its defined with in the js files linked to adminMenu.html.

When going to the individual adminMenu.html page it loads, however when specifying the controller in routeProvider it never loads. Any ideas?

有帮助吗?

解决方案

if you defined your controller like this:

function MyCtrl($scope) {
}

You will have to specify your controller like this (without the quotes):

.when('/default', {
     templateUrl: 'myCtrl.html',
     controller :  MyCtrl
 })
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top