2014-09-15 17 views
0

AngularJS에서 이벤트를 사용하려고하지만 제목에 오류가 표시됩니다.

Followed this example 아주 단순하고 오류가있는 원인에 대해서는 확실하지 않은 것처럼 보입니다.

내 코드 :

.controller('FooterCtrl', [function($scope) { 

    var showTime = false; 

    $scope.$on('flip', function (event, args) { 
     showTime = !showTime; 
    }); 

}]); 

.controller('View3Ctrl', [function($scope) { 

     $scope.$emit('flip', args); 

}]); 

사람이 오류가 무슨 뜻을 해결하는 방법을 알고 있나요? $ scope이 정의되지 않은 이유는 무엇입니까?

+0

가능한 중복 시도 [AngularJS와 범위 $ 컨트롤러 모듈 내에있는 경우 정의 (http://stackoverflow.com/questions/16284769/angularjs-scope-undefined-when-controllers -are-inside-a-module) – naththedeveloper

답변

0
.controller('FooterCtrl', ["$scope",function($scope) { 

    var showTime = false; 

    $scope.$on('flip', function (event, args) { 
     showTime = !showTime; 
    }); 

}]); 

.controller('View3Ctrl', ["$scope",function($scope) { 

    $scope.$emit('flip', args); 

}]); 

는이 하나

관련 문제