【发布时间】:2017-12-19 16:54:33
【问题描述】:
我试图弄清楚如何在功能完成后更新以下 $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.doSomething() 返回后使用 $scope.Complete() 中的详细信息更新 $scope.inProgress() 。
有人可以就我需要做出哪些改变给我一些建议吗?我试图在提交函数的末尾修改 $scope.inProgress,但我总是最终显示一个新的确认框或实际上没有更改某些内容。
我目前的想法类似于
$scope.ConfirmationControl = function() {
$scope.inProgress(){
storageService.doSomethingCool().then(
$scope.inProgress() = //updated elements
)
}
}
这有意义吗?我是关闭还是认为这完全错误?
提前感谢您的帮助! :)
【问题讨论】:
标签: javascript jquery angularjs node.js