Domanda

$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?

È stato utile?

Soluzione

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
 })
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top