Skip to content

Instantly share code, notes, and snippets.

@paulwsmith
Created July 31, 2014 21:09
Show Gist options
  • Save paulwsmith/42795a977fddbf3dcb16 to your computer and use it in GitHub Desktop.
Save paulwsmith/42795a977fddbf3dcb16 to your computer and use it in GitHub Desktop.
angular.module('wizehive.services')
.service('PluginEvents', ['$rootScope', '$timeout', function($rootScope, $timeout) {
var scopes = {
// This would be set up dynamically, maybe by plugin directive?
'action-panel-top': $rootScope.$new(false),
'top-nav': $rootScope.$new(false)
};
return function(location) {
// location = 'action-panel-top'
return {
$watch: function(expression, callback) {
scopes[location].$watch(expression, callback);
}
};
};
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment