A handy directive to request Notification permission from user.
- Chrome >= v22.0
- Firefox >= v22.0
To use this directive, fist you need to install it via Bower. I assume you already install the Bower:
bower install kabam-requestNotificationPermission
Include the directive script requestNotificationPermission.js
into your application:
<script type="text/javascript" src="bower_components/kabam-requestNotificationPermission/requestNotificationPermission.js"></script>
Add kabam.requestNotificationPermission
as a module dependency to your application
angular.module('yourAwesomeApplication', [
'kabam.requestNotificationPermission'
]);
To use this directive, you need to add new attribute request-notification-permission
to your html element.
For examples:
You might want to use the directive this way if you need to get the user permission in the first time they load the application.
<body request-notification-permission>Call</body>
You might want to use the directive this way if you need to get the user permission after they click some element or button.
<button request-notification-permission>Call</button>
The attribute can be given a value that should evaluate to a boolean (or 'true' / 'false' string) to enable / disable it. For example:
<body request-notification-permission="{{isLogin}}">Call</body>
Would use the value of $scope.isLogin to only make the request after the user is logged-in
To install the dev dependencies:
npm install
To run the unit tests:
npm test
Licensed under the MIT License.