Tutorialsplane

Angular Material Toast


Angular Material Toast: The service $mdToast is used to build to toast notification which can be placed anywhere on the screen. Here in this tutorial we are going to explain how you can create toast notification and place them on screen. You can also use our online editor to edit and run the code online.


Angular Material Toast Example

By default toasts are placed at the bottom when screen size is between 600px and 959px. Let us create a simple example using this service($mdToast)-

Angular Material Toast Example:


   
      
      
      
      
      
      
	  
	 
      
      
   
   
  <div ng-controller="MyController as ctrl" ng-cloak=""> 
  <div layout="column" layout-fill="">
      <md-button ng-click="openToast()">
	    Open First Toast.
      </md-button>
  </div>
  </div>
  
                                                                                                                                                                                                                                                               
Try It On →

In the above example we have created a simple toast with default position which will display information at the default position ie. bottom.

Note : Make Sure you have imported the service $mdToast in controller.

If you run the above example it produce output something like this –

Learn Angular Material