Angular dialog example

In this post I'll explain how to create Angular dialog based on Angular Material. We'll work on 4 type of dialog.
  • Alert Dialog.
  • Confirm Dialog.
  • Tab Dialog.
  • Custom Dialog.

  1. Alert Dialog



- Create a button which will be click on to show alert dialog
 <md-button class="md-primary md-raised" ng-click="showAlert($event)" flex-sm="50" flex-md="100" flex-gt-md="20">  
    Show Alert Dialog  
  </md-button>  

- CSS

 .dialogdemoBasicUsage #popupContainer {  
  position: relative;  
 }  
 .dialogdemoBasicUsage .footer {  
  width: 100%;  
  text-align: center;  
  margin-left: 20px;  
 }  
 .dialogdemoBasicUsage .footer,  
 .dialogdemoBasicUsage .footer > code {  
  font-size: 0.8em;  
  margin-top: 50px;  
 }  


- And then Js with showAlert function

 $scope.showAlert = function(ev) {  
   $mdDialog.show(  
    $mdDialog.alert()  
    .parent(angular.element(document.querySelector('#popupContainer')))  
    .clickOutsideToClose(true)  
    .title('Alert title')  
    .textContent('This is a alert message.')  
    .ariaLabel('Alert Dialog Demo')  
    .ok('OK')  
    .targetEvent(ev)  
   );  
  };  

Demo

   2. Confirm Dialog.
        This example will help you know how to make a confirm dialog by AngularJs Material.


         Description:: after user choose products and then click delete button this confirm dialog will be displayed.

How to do.
- Create a button which will be click on to show alert dialog

  <md-button class="md-primary md-raised" ng-click="showConfirm($event)">  
    Confirm Dialog  
   </md-button>  

- Add Css

 .dialogdemoBasicUsage #popupContainer {  
  position: relative; }  
 .dialogdemoBasicUsage .footer {  
  width: 100%;  
  text-align: center;  
  margin-left: 20px; }  
 .dialogdemoBasicUsage .footer, .dialogdemoBasicUsage .footer > code {  
  font-size: 0.8em;  
  margin-top: 50px; }  
 .dialogdemoBasicUsage button {  
  width: 200px; }  
 .dialogdemoBasicUsage div#status {  
  color: #c60008; }  
 .dialogdemoBasicUsage .dialog-demo-prerendered md-checkbox {  
  margin-bottom: 0; }  

- And then Js with showAlert function

  $scope.showConfirm = function(ev) {  
   // Appending dialog to document.body to cover sidenav in docs app  
   var confirm = $mdDialog.confirm()  
      .title('Would you like to delete this products?')  
      .textContent('All products will be deleted if you choose Yes.')  
      .ariaLabel('Lucky day')  
      .targetEvent(ev)  
      .ok('Yes!')  
      .cancel('No');  
   $mdDialog.show(confirm).then(function() {  
    $scope.status = 'You decided to delete.';  
   }, function() {  
    $scope.status = 'You decided to keep your products.';  
   });  
  };  

Demo


   3. Tabs Dialog.
        on-going
   4. Custom Dialog.
       on-going  


    36 comments:

    1. The AngularJS framework works by first reading the HTML page, which has embedded into it additional custom tag attributes. This blog gives great view for Angular.js beginners. Learn Angular.js from the best Angular.js Online Training in your locality at CatchExperts.com

      ReplyDelete
    2. Thanks a lot for sharing this amazing knowledge with us. This site is fantastic. I always find great knowledge from it.
      Hire Angular JS Developer

      ReplyDelete
    3. Awesome tutorial . It is very helpful for web development and design. AngularJS is a very powerful JavaScript Framework. web design company jaipur

      ReplyDelete
    4. This comment has been removed by the author.

      ReplyDelete
    5. Its really useful detail about Mean stack. Thanks for this information.
      MEAN Stack Training in Hyderabad

      ReplyDelete
    6. Thanks for sharing the useful blog posts about Dialog boxes in Angular with example code.

      Web Design Company in Coimbatore

      ReplyDelete
    7. I am learning web designing course in jaipur.
      This article tells in detail about website design and development. Thanks for sharing a great article.

      ReplyDelete
    8. This comment has been removed by the author.

      ReplyDelete
    9. Fantastic article with valuable information found very helpful waiting for next blog thank you.
      typeerror nonetype object is not subscriptable

      ReplyDelete
    10. Tremendous blog quite easy to grasp the subject since the content is very simple to understand. Obviously, this helps the participants to engage themselves in to the subject without much difficulty. Hope you further educate the readers in the same manner and keep sharing the content as always you do.

      Data Science certification in Raipur

      ReplyDelete
    11. Amazing article with informative information found valuable and enjoyed reading it thanks for sharing.
      Data Analytics Course Online

      ReplyDelete
    12. It's like you understand the topic well, but forgot to include your readers. Maybe you should think about it from several angles.

      Data Analytics Course in Bangalore

      ReplyDelete
    13. Saham perusahaan diterbitkan di atas kertas, memungkinkan investor untuk memperdagangkan saham bolak-balik dengan investor lain, tetapi bursa yang diatur tidak ada sampai pembentukan Bursa Efek London (LSE) pada tahun 1773. Meskipun sejumlah besar gejolak keuangan mengikuti pendirian segera dari LSE, perdagangan pertukaran secara keseluruhan berhasil bertahan dan berkembang sepanjang tahun 1800-an. cek juga markets dan Saham Syariah Sektor Keuangan

      ReplyDelete
    14. A good blog always comes-up with new and exciting information and while reading I have felt that this blog really has all those qualities that qualify a blog to be a one.

      Best Data Science courses in Hyderabad

      ReplyDelete
    15. The Extraordinary blog went amazed by the content that they have developed in a very descriptive manner. This type of content surely ensures the participants explore themselves. Hope you deliver the same near the future as well. Gratitude to the blogger for the efforts.


      Machine Learning Course in Bangalore

      ReplyDelete
    16. Thank you very much for this interesting article. In fact, it is exceptional. You are looking for this type of notice later.

      Data Scientist Course in Nagpur

      ReplyDelete
    17. I have learned some information about your blog from this post on your blog, which is very informative explanation of the Very Large Scale Integration Future Technology | VLSI technology is an acronym for very large integrated circuits, which is a fancy way of saying that the chips in modern digital devices—computers, mobile phones, cars, and so on—are made from thousands of tiny transistors—the building blocks of modern digital electronics.

      ReplyDelete
    18. This comment has been removed by the author.

      ReplyDelete
    19. I visited various websites but the audio feature for audio songs current at this site is really wonderful.|business analytics course in jodhpur

      ReplyDelete
    20. It has increases the importance of the field. If you have also been attracted by the value of data science and want to learn it, you have to understand the basic courses of data science you need to learn to move successfully in the industry.
      data science course in patna

      ReplyDelete
    21. I recommend everyone to read this blog as it has some of the best data science content you will find. The best part is that the writer presented the information in an engaging and engaging way. Each line gives you something new to learn, and that says a lot about the quality of the information presented here.


      Kickstart your career by enrolling in this Best Training institute in Chennai for Data Science

      ReplyDelete
    22. That was a really great! Thanks for the data and the supporting information. I am a new blogger. read more, i have a
      blog i will refer back to this site for steps and tips.

      ReplyDelete
    23. Great example of Angular dialog implementation! As a Digital Marketing Agency in Coimbatore, we often work on web development projects where features like these improve user experience. This tutorial is clear and helpful—thanks for sharing!

      ReplyDelete

    Popular Posts