Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 5 snack-bar Notifications

I want to implement notifications messages like

"Success! Your Details Added"
"Warning! Something Went Wrong"
"Danger! You don't have access to this"

i am already using angular material in my application can i use 'snack-bar' for notification purpose?

i also found some related toaster at npm

Suggest me if there is an another way to do this.

like image 700
Developer Avatar asked Feb 08 '18 01:02

Developer


2 Answers

I use this ngx-toastr, demo

  • Toast Component Injection without being passed ViewContainerRef
  • No use of *ngFor. Fewer dirty checks and higher performance.
  • AoT compilation and lazy loading compatible
  • Component inheritance for custom toasts
  • SystemJS/UMD rollup bundle
  • Animations using Angular's Web Animations API (polyfill needed for older devices)
  • Output toasts to an optional target directive
like image 123
xeofus Avatar answered Oct 02 '22 09:10

xeofus


Though you are using angular material so its better to use snack-bar of angular material.

If you want to look for other options then you can also use growl of primeng or message of primeng

You can also write custom code for showing this kind of message you want. But in that case you have to control externally a lot of things like position of that message, timing, dismissing etc

So the choice is absolutely yours.

like image 31
Ashraful Islam Avatar answered Oct 02 '22 09:10

Ashraful Islam