Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Materialize.toast in angular 2

I am working on angular 2. I have used materialize-css which works fine with classes But problem came with materialize toast. I Configured materialize with gulpfile.js do i need to add any other js file in gulpfile?

<a class="btn" (click)="Materialize.toast('I am a toast', 4000)">Toast!</a>

Used this console shows error
Materialize is not defined

like image 935
Dimple Avatar asked Mar 12 '23 21:03

Dimple


1 Answers

This works for me. Wish I knew why - I could not find this documented anywhere.

import { toast } from 'angular2-materialize';

ngOnInit() {
   toast("I am the best toast there is!", 4000);
}
like image 119
Larry Garrett Avatar answered Mar 23 '23 23:03

Larry Garrett