-
-
Save mackwic/5888526 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope.$watch(function () { | |
return SessionService.currentUser; | |
}, function (user) { | |
$scope.user = user; | |
}, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.service('MyService', function() { | |
return { | |
value: 'default', | |
handlers: [], | |
getProperty : function(onChangeCallback) { | |
handlers.push(onChangeCallback); | |
return value; | |
}, | |
setProperty : function(newVal) { | |
value = newVal; | |
handlers.forEach(function(e) { e(newVal); }); | |
} | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment