I have a ionic2 project and now I want to add iziToast into it. I tried importing it like follows:
import { izitoast } from 'izitoast';
But it gives me izitoast
as undefined. However, I tried searching for the angular2 support for this library and I found ng2-iziToast
It's not working just installing and importing it to the app.module
You are trying to import a named export izitoast
like you are used to in Ionic/Angular (import { x } from 'y'
) but izitoast is not built on the ES2015 standard, which means we have to import it like this:
After running npm install izitoast --save
import izitoast from 'izitoast';
and to use it:
izitoast.show(...);
Check out the ionic docs on how to work with 3rd party libs.