質問

$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