Skip to content

Instantly share code, notes, and snippets.

@electblake
Last active November 5, 2019 09:14
Show Gist options
  • Select an option

  • Save electblake/4994d8b251952bdbcd99 to your computer and use it in GitHub Desktop.

Select an option

Save electblake/4994d8b251952bdbcd99 to your computer and use it in GitHub Desktop.
simple config to expose postal.js under $scope.$bus
'use strict';
angular.module('myApp') // use whatever your app is using to load configs
.config(['$provide', function ($provide) {
$provide.decorator('$rootScope', [
'$delegate', function ($delegate) {
Object.defineProperty($delegate.constructor.prototype,
'$bus', {
value: postal, // probably could wrap into window.postal but this works fine for me
enumerable: false
});
return $delegate;
}]);
}]);
// @url https://github.com/postaljs/postal.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment