Needful Program Management

    ng2-messages

    0.1.4 • Public • Published

    ng2messages

    Angular2 messages component for displaying messages to user.

    example

    In main app component:

    import { MessagesService, MessagesComponent } from './your_path/ng2-messages/ng2-messages';
     
    @Component({
      ...
      providers:[MessagesService],
      directives:[MessagesComponent]
      ...
    })

    In your main app template:

    <ng2-messages></ng2-messages>
     
    <button (click)="msg.success('You are awesome!')">Click me fast!</button>

    In some module that want to tell something to user:

    ...
    import {MessagesService} from './your_path/ng2-messages/ng2-messages';
     
    @Component({
      ...
    })
    export class YourComponent {
     
      constructor(public msg:MessagesService){}
     
      showError(msg){
        this.msg.error("There will be blood...");
      }
     
      showSuccess(msg){
        this.msg.success("Nice work!");
      }
     
      showInfo(msg){
        this.msg.info("Better remove that picture");
      }
     
      showWarning(msg){
        this.msg.warning("I'm warning you");
      }
     
    }

    (author: dedykowane aplikacje dla firm)

    Install

    npm i ng2-messages

    DownloadsWeekly Downloads

    2

    Version

    0.1.4

    License

    ISC

    Last publish

    Collaborators

    • neuronet.io