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 ?
- Deploying Your Web App using Azure App Service
- $timeout service in AngularJS
- Why is Parse Server the future of Backend As A Service?
- Messaging Via Azure Service bus | SendMessage and ScheduleMessage
- Google Geo-coding Web Service (JSON response)
- How to create shapes using CSS ?
- How to Create Modules in Node.js ?
- How to create a skewed background using CSS ?
- PHP | Collator create() Function
- How to create and read value from cookie ?
- How to create an array for JSON using PHP?
- How to create static classes in PHP ?
- How to Create ToDo App using ReactJS ?
- How to create a PHP form that submit to self ?
- How to create optional arguments in PHP ?
- How to create UI Datepicker using jQuery ?
- How to Create Wave Background using CSS ?
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.