【发布时间】:2014-09-15 16:42:48
【问题描述】:
尝试在 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 未定义?
【问题讨论】:
标签: javascript html angularjs angularjs-scope