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

Image


- 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.

Image

         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  


    39 comments:

    1. Image
    2. Image
    3. Image

      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
    4. Image

      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
    5. Image

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

      ReplyDelete
    6. Image
    7. Image

      This comment has been removed by the author.

      ReplyDelete
    8. Image

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

      ReplyDelete
    9. Image
    10. Image

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

      Web Design Company in Coimbatore

      ReplyDelete
    11. Image
    12. Image

      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
    13. Image

      This comment has been removed by the author.

      ReplyDelete
    14. Image
    15. Image
    16. Image
    17. Image

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

      ReplyDelete
    18. Image

      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
    19. Image

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

      ReplyDelete
    20. Image

      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
    21. Image
    22. Image

      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
    23. Image

      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
    24. Image

      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
    25. Image
    26. Image
    27. Image
    28. Image
    29. Image

      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
    30. Image

      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
    31. Image

      This comment has been removed by the author.

      ReplyDelete
    32. Image

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

      ReplyDelete
    33. Image

      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
    34. Image

      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
    35. Image

      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
    36. Image

      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
    37. Image

      Thank you very much for this interesting article.
      https://darshanelderscare.com/
      https://darshanmedicare.in/

      ReplyDelete
    38. Image

      elder care services in bangalore providing compassionate and personalized elder care services in Bangalore, ensuring dignity, comfort, and well-being for your loved ones.
      https://darshanelderscare.com

      ReplyDelete
    39. Image

      / Opens a Material dialog with a title, content, and a close button when triggered.
      <a href="https://digitalfloats.com/video-editing-course-in-hyderabad/">Angular dialog example;/a>
      https://digitalfloats.com/video-editing-course-in-hyderabad

      ReplyDelete

    Popular Posts