A service with a 3rd party library callback function:
mbAppModule.service(\'aService\', function ($http) {
this.data={\"somedata\":0};
var m3rdPartLib=\
If you´re using scope in your service then it is a good indicator that you´re breaking SRP cause your service should only retrieve data to your controller. My suggestion is that you could do something like this.
mbAppModule.service('aService', ["$http", "$rootScope", function ($http, $rootScope) {
this.data = {
"somedata": 0
};
var m3rdPartLib = "init"; // init
this.GetPartLib = function () {
return m3rdPartLib;
}
}]);
mbAppModule.controller({
MController: function ($scope, $http, mService) {
this.GetPartLib = function (){
mService.on('timeupdate', function() {
this.data.somedata=1;
});
}
});