I'm using materialize-css without installing any other npm packages (as suggested on the materialize-css website). The site suggest invoking a javascript method: Materialize.toast('my toast', 2000) in order to programmatically perform a toast. How do I invoke a javascript method against the Materialize object? Does someone have an example? I'm also using angular/CLI and have jquery and materialize loaded via angular-cli.json
0
votes
1 Answers
0
votes
you can use event emitter from @angular/core
import {MaterializeAction} from 'angular2-materialize';
import { EventEmitter } from '@angular/core';`
export class..
{
`toastModule = new EventEmitter<string|MaterializeAction>();`
..........
now create a function
`toastMe(){
this.toastModule.emit('toast');
}
}`
in html
<a class="btn" (click)="toastMe()" materialize [materializeParams]="['it a toast',4000]" [materializeActions]="toastModule">Toast me </a>