title: Angularjs - How to cancel change event on dropdown when the confirm dialog is false?
body: <p>I am using Angularjs. My problem is when I select a new option in my dropdown, a dialog will appear. If the result of the dialog is false, the selected dropdown option must be the same. Getting ideas from other devs will be analyzed. Thank you in advance!</p>
  
  <p>Refer to my code snippet below:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div ng-app="myApp" ng-controller="myCtrl"&gt;
    &lt;select ng-model="myDropDown" ng-change="Dialog()"&gt;
      &lt;option&gt;a&lt;/option&gt;
      &lt;option&gt;b&lt;/option&gt;
    &lt;/select&gt;
  &lt;/div&gt;
  
  &lt;script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
  var app = angular.module('myApp', []);
  app.controller('myCtrl', function($scope) {
      $scope.Dialog = function () {
          var dialog = confirm('Continue?');
          if(!dialog) {
           alert("Option must not change");
              /** The problem is the dropdown still select the option. **/
          }
      }
  });
  &lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>