Toastr notification for Angular templates
Hi,
Currently, I'm using an Angular based template but I noticed that Toastr is not part of the demo. Searching on the documentation, I noticed that it is implemented as part of HTML.
https://preview.keenthemes.com/html/metronic/docs/general/toastr
Do you have a workaround to use Metronic Toastr for Angular applications?
PD: This is critical for my notifications system and I would like to continue using the Metronic look and feel and avoid installing external libraries that add more weight to the application.
Thanks in advance.
Replies (1)
Hi Carlos,
You can use the Metronic Toastr for Angular applications by installing the ngx-toastr package. Here are the steps:
- Install the ngx-toastr package using npm:
- Import the BrowserAnimationsModule and ToastrModule in your app.module.ts file:
- In your component where you want to use Toastr, import the ToastrService and use it in your code:
With this setup, you can use the Toastr service in your Angular application. By right, it will keep the Metronic look and feel for your notifications system.
Moreover, the Metronic custom Toastr style is already included in the <code>_toastr.scss</code> file, which can be found in the <code>demo1/src/assets/sass/core/vendors/plugins/</code> directory. You can also confirm that it is imported in the <code>_plugins.scss</code> file located in the same directory.
Thanks