angular2-flash-messages
angular2-flash-messages copied to clipboard
Wrapper around flashmessages
Hi,
I have a service around the flash messages service as following:
import { Injectable } from '@angular/core';
import { FlashMessagesService } from 'angular2-flash-messages';
@Injectable()
export class MessagesService {
constructor(private flashMessagesService: FlashMessagesService) {}
public show(message: string, cssClass: string = 'success') {
this.flashMessagesService.show(message, {
cssClass: cssClass,
closeOnClick: true,
showCloseBtn: true,
timeout: 5000
});
}
}
And in my component as following:
constructor(
private messages: MessagesService,
){}
ngOnInit() {
this.messages.show('Test', 'success');
}
But when this runs I get the following error:
ManagementLocationsComponent.html:1 ERROR TypeError: this.flashMessagesService.show is not a function
Any ideas what is going wrong over here?
Kind regards, Yanick