Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrapper around flashmessages #48

Open
yanickvanbarneveld opened this issue Nov 21, 2018 · 0 comments
Open

Wrapper around flashmessages #48

yanickvanbarneveld opened this issue Nov 21, 2018 · 0 comments

Comments

@yanickvanbarneveld
Copy link

yanickvanbarneveld commented Nov 21, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant