0.1.4 • Published 8 years ago
ng2-messages v0.1.4
ng2messages
Angular2 messages component for displaying messages to user.
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)