Skip to content

Instantly share code, notes, and snippets.

@stoyanvi
Forked from escalant3/gist:9783136
Created March 28, 2014 13:25
Show Gist options
  • Save stoyanvi/9832632 to your computer and use it in GitHub Desktop.
Save stoyanvi/9832632 to your computer and use it in GitHub Desktop.
angular.module('foo', [])
.config(function($provide) {
$provide.decorator('$rootScope', function ($delegate) {
// Shim needed for browsers I don't care about
var proto = Object.getPrototypeOf($delegate);
proto.$bar = function() {
// Do something
};
return $delegate;
})
})
.controller('MainCtrl', function($scope) {
$scope.$bar();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment