Angular $ rootScope. $ on Undefined

The controller has the following.

$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 returns undefined. Does anyone know the reason for this?

My controller:

 app.controller('indexcontroller', ['$rootScope','$scope', '$http', 'dataFactory', function ($scope,$http,$rootScope, dataFactory) { 
+7
angularjs angularjs-scope
source share
1 answer

The order of the dependencies must match the array in which it was declared:

 app.controller('indexcontroller', ['$rootScope','$scope', '$http', 'dataFactory', function ($rootScope, $scope, $http, dataFactory) { 
+24
source share

All Articles