title: How to use the directive with the button click in AngularJS?
body: <p>I have directive named openDialog as follows. How can I use it from the view with the button click? Here is my code for the directive</p>
  
  <pre><code>app.directive('openDialog', ['ngDialog', function (ngDialog) {
      return {
         restrict: 'A',
         link: function ($scope, $element, $attrs) {
             var openDialog = function () {
  
                 ngDialog.open({
                     //template: $attrs.openDialog,
                     template: 'src/app/reservation/addReview.html',
                     //ngDialog.open({ template: 'src/app/reservation/addReview.html'}),
                     scope: $scope,
                     showClose: false,
                     closeByEscape:true
                 });
             };
             $element.on('click', openDialog);
         }
     };
  }]);
  </code></pre>