0.1.11 • Published 7 years ago

a2-notifications v0.1.11

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

A2-notifications

Simple Angular2 component for showing messages.

Demo:

Install package:

npm install --save a2-notifications

Include:

...
import { a2NotificationsComponent, a2NotificationsService } from 'a2-notifications';

@NgModule({
  declarations: [
    ...
    a2NotificationsComponent // a2 component
  ],
  imports: [
    ...
  ],
  providers: [
    a2NotificationsService // a2 service
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

In main HTML component add:

<a2-notifications></a2-notifications>

And use them on your page:

...
import { a2NotificationsService } from 'a2-notifications'; // Import a2 service

@Component({...})
export class NameOfComponent {

  // add service in constructor
  constructor(private notify: a2NotificationsService){}

  // blue message color
  info(text){
    this.notify.info(text);
  }

  // green message color
  success(text){
    this.notify.success(text);
  }

  // red message color
  error(text){
    this.notify.error(text);
  }

}

You can transfer display time with second parameter. (In ms)

If you transfer not the number, then the message will not dissapear.

0.1.11

7 years ago

0.1.10

7 years ago

0.1.9

7 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago