Frage

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

War es hilfreich?

Lösung

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
 })
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top