Adds a
$subscribe
method to the$scope
prototype. $on listeners with automagic de-registration.
/** with bower **/
bower install angular-subscribe --save
<script src="path/to/angular-subscribe/dist/angular-subscribe.js"></script>
/** with jspm **/
jspm install angular-subscribe --save
import 'angular-subscribe';
angular.module('your_module_name', [ 'angular-subscribe' ]);
$scope.$subscribe('event', callbackFn);
/** becomes **/
var unsub = $rootScope.$on('event', callbackFn);
$scope.$on('$destroy', unsub);
npm install; npm test
MIT © Kasper Lewau