项目作者: seiyria

项目描述 :
PNotify for angular2.
高级语言: JavaScript
项目地址: git://github.com/seiyria/ng2-pnotify.git
创建时间: 2016-06-26T03:55:41Z
项目社区:https://github.com/seiyria/ng2-pnotify

开源协议:MIT License

下载


ng2-pnotify

A service wrapping PNotify for ng2.

Install

npm i -s ng2-pnotify

Usage

First, bootstrap the service globally:

  1. import { PNotifySettings } from 'ng2-pnotify';
  2. bootstrap(App, [
  3. provide(PNotifySettings, { useValue: { styling: 'bootstrap3' } }) // defaults to 'brighttheme'
  4. ]);

Next, inject it into a component:

  1. import { PNotifyService } from 'ng2-pnotify';
  2. @Component({
  3. providers: [PNotifyService],
  4. template: `<button (click)="notify()">click</button>`
  5. })
  6. export class MyComponent {
  7. static get parameters() {
  8. return [[PNotifyService]];
  9. }
  10. constructor(pnotify) {
  11. this.pnotify = pnotify;
  12. }
  13. notify() {
  14. this.pnotify.info({ text: 'hello!' });
  15. }
  16. }

Options

Name Default Description
styling ‘brighttheme’ The theme for pnotify to use. Valid settings are ‘brighttheme’, ‘jqueryui’, ‘fontawesome’, ‘bootstrap3’ - you must have the corresponding CSS for each of these.

Functions

Name Description
success Creates a success dialog.
notice Creates a notice dialog.
error Creates an error dialog.
info Creates an info dialog.
pnotify Creates a custom dialog.
desktop Requests permission to use desktop mode.

TODO

Wrappers for more functions, like prompts, modals, confirms.