문제

$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