Skip to content

mykabam/requestNotificationPermission

Repository files navigation

requestNotificationPermission directive

Build Status Dependency Status

A handy directive to request Notification permission from user.

Browser supports

  • Chrome >= v22.0
  • Firefox >= v22.0

How to Install

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'
]);

How to Use

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

Running Tests

Install dev dependencies

To install the dev dependencies:

npm install

To run the unit tests:

npm test

License

Licensed under the MIT License.

About

A handy directive to request Notification permission from user

Resources

License

Stars

Watchers

Forks

Packages

No packages published