AngularJS,AngularConfirm – 一旦函数完成,更新确认对话框

我想弄清楚如何在一个函数完成后进行下面的$ ngConfirm框更新。

点击提交后,出现以下内容(齿轮旋转):

在这里输入图像说明

$scope.inProgress = function(){ $ngConfirm({ theme: 'modern', icon: "fa fa-cog fa-spin fa-.5x fa-fw", title: 'File is downloading Please wait.', content: "", buttons: { } }); }; 

在显示这个框之后,函数doSomething()被调用。 一旦该函数返回,我想更新显示为以下(齿轮停止):

在这里输入图像说明

 $scope.Complete = function(){ $ngConfirm({ theme: 'modern', icon: "fa fa-cog fa-.5x fa-fw", title: 'Spreadsheet Generated!', content: "File size is {$scope.fileSize}, Do you want to save it?", buttons: { 'Yes, save my file': { downloadStuff(); $ngConfirm('Spreadsheet saved to "Downloads" folder.'); }, 'No, take me back': { action: function(){ $ngConfirm('Download has been cancelled.'); } } } }); }; 

这是我目前在我的控制器中的submit()函数中设置的方式:

 $scope.submit = function() { $scope.inProgress(); $scope.doSomething(); $scope.Complete(); }; 

使用上面的代码,我的应用程序显示了彼此分层的两个元素。 我卡住试图弄清楚如何使$ scope.inProgress()更新$ scope.Complete()内的细节一旦$ scope.doSomething()返回。

有人可以给我一些build议,我需要做什么改变? 我试图在提交函数的末尾修改$ scope.inProgress,但是我总是最终显示一个新的确认框或者实际上没有改变某些东西。

我目前的想法是沿线的东西

 $scope.ConfirmationControl = function() { $scope.inProgress(){ storageService.doSomethingCool().then( $scope.inProgress() = //updated elements ) } } 

那有意义吗? 我是closures还是想着这个完全错误?

预先感谢您的帮助! 🙂

angular度确认

有一个如何更改网站上的内容的例子。 https://craftpip.github.io/angular-confirm/#quickfeatures 。 在function标题下,您可以点击标有“对话框”的button来查看示例。 基本上,你将需要把一切都放在content:选项与一些范围variables。 当doSomething()完成时,设置一个$ scopevariables(在这个例子中是$scope.somethingWasDone ),在你的对话框中有ng-if 。 以下是一个未经testing的例子。

 $scope.inProgress = function(){ $scope.title = 'File is downloading. Please wait.'; $ngConfirm({ scope: $scope, icon: "fa fa-cog fa-spin fa-.5x fa-fw", content: '<h2>{{title}}</h2>' + '<div ng-if="somethingWasDone">' + '<div>File size is 250kb, do you want to save it?</div>' + '<button ng-click="downloadStuff()">Yes</button>' + '<button ng-click="cancel()">No</button>' + '</div>' }); }; // when your doSomething function is done $scope.doSomething().then(function(result) { $scope.title = 'Spreadsheet Generated!'; $scope.somethingWasDone = true; });