Skip to content Skip to sidebar Skip to footer

How To Pass Data From Third-Party Library Callback (firebase) To View In AngularJS

I'm working on upload files using angularjs and firebase I'm trying pass parameters from controller to view inside state_changed event It's not working , I can print it on contro

Solution 1:

Because the firebase event happens outside the AngularJS framework, changes to $scope need to use $scope.$apply()

$scope.$apply(function() {
    $scope.progress = progress;
});

From the Docs:

Angular modifies the normal JavaScript flow by providing its own event processing loop. This splits the JavaScript into classical and Angular execution context. Only operations which are applied in Angular execution context will benefit from Angular data-binding, exception handling, property watching, etc... You use $apply() to enter Angular execution context from JavaScript.

Keep in mind that in most places (controllers, services) $apply has already been called for you by the directive which is handling the event. An explicit call to $apply is needed only when implementing custom event callbacks, or when working with third-party library callbacks.

For more information, see


Post a Comment for "How To Pass Data From Third-Party Library Callback (firebase) To View In AngularJS"