MatSnackBar is an angular directive that’s used for showing a notification bar specifically on the mobile devices.
These types of UI components are generally used several times.
So to avoid the repetition of code, a service can simply be created to use SnackBar in different components.
ng g s snackBar
Now call the openSnackBar function wherever it is required, with the help of snackBService.
- Service Worker | How to create custom offline page ?
- Why is Parse Server the future of Backend As A Service?
- Google Geo-coding Web Service (JSON response)
- $timeout service in AngularJS
- Deploying Your Web App using Azure App Service
- Messaging Via Azure Service bus | SendMessage and ScheduleMessage
- How to watch service variables ?
- Create a Website Alarm Using Python
- How to create a responsive Modal Sign-Up form for a Website?
- How to create an HTML button that acts like a link?
- How to create optional arguments for a SASS mixin?
- How to create Glowing Star effect using HTML and CSS?
- Create a web server and run PHP script on it using Raspberry Pi
- Create an unordered list without any bullets using CSS
- How to create slide left and right toggle effect using jQuery?
- How to create directory with HTML button and PHP ?
- How to create comma separated list from an array in PHP ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.