angularjs – Angular $rootScope.$on Undefined

前端之家收集整理的这篇文章主要介绍了angularjs – Angular $rootScope.$on Undefined前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在控制器中有以下内容.
$rootScope.$on('progressbarEvent',function (event,data) {
    $rootScope.progresscurrent = data.currentprogress;
    console.log('Event listening: ' + $rootScope.progresscurrent);
});

I have this in a factory service.
   $rootScope.$emit('progressbarEvent',dataFactory.currentprogress);

$on返回undefined.谁知道这个的原因?

我的控制器是:

app.controller('indexcontroller',['$rootScope','$scope','$http','dataFactory',function ($scope,$http,$rootScope,dataFactory) {
依赖关系的顺序必须与声明的数组一致:
app.controller('indexcontroller',function ($rootScope,$scope,dataFactory) {

猜你在找的Angularjs相关文章