A service with a 3rd party library callback function:
mbAppModule.service(\'aService\', function ($http) {
this.data={\"somedata\":0};
var m3rdPartLib=\
I needed to update an input field from a service because it had listeners and what not that changed data randomly and dynamically.
This could be used to call scope functions in the controller as well:
//scope will be set to current scope of a controller
//which has an ng-view containing this element
var scope = angular.element('#input-element').scope();
//wrap changes in an apply call to make sure view and model are consistent
scope.$apply(function() {
scope.object.data = value;
});
Thanks to this post: How do I access the $scope variable in browser's console using AngularJS?