ngDialog confirm multiple click
<p>Via ngDialog popup window I am collecting data to a $scope array. If a user clicks confirm button multiple times, data will be added multiple times. I have tried ngDisable by $scope variable to disable the the button but unfortunately ngDialog  popup window does not pick up scope changes until confirm function is completed.
<a href="https://jsfiddle.net/lasith011/11cdp05c/" rel="nofollow noreferrer">https://jsfiddle.net/lasith011/11cdp05c/</a></p>

<pre><code>var myApp = angular.module('myApp',['ngDialog']);

myApp.controller('MyCtrl', function ($scope, ngDialog) {
        $scope.names = [];
    $scope.openDialog = function(){
        ngDialog.open({
        scope: $scope,
        template: 'templateForm',
        closeByDocument: false,
        controller: 'PopUpController'
      });
    }
});
myApp.controller('PopUpController', function($scope, ngDialog, $timeout){
    $scope.cancel = function(){
    ngDialog.close();
  };
  $scope.submit = function(){
    $scope.disable = true;
    //Some calculation
    $timeout(function(){
        $scope.names.push($scope.varName);
      ngDialog.close();
    }, 1000);   
    $scope.disable = false;
  };
});
</code></pre>