Last active
November 5, 2019 09:14
-
-
Save electblake/4994d8b251952bdbcd99 to your computer and use it in GitHub Desktop.
simple config to expose postal.js under $scope.$bus
This file contains hidden or 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
| '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