【发布时间】:2017-06-13 13:07:52
【问题描述】:
我使用了 AngularJS v1.5.3 & vendor.bundle.js 和 app.bundle.js
在此单击以显示按钮并显示 swal 确认框,我按下“是的,显示它!”按钮和 div 不显示但是,我第二次按下然后显示这个 div,我的意思是 $scope.displayDiv 值正在改变,但第一次没有任何影响 请给我解决方案
我在这里粘贴我的代码:
<div class="input-group" ng-show="displayDiv" >
DOM data
</div>
<button class="" ng-click="disDiv()">Show</button>
$scope.displayDiv=0;
$scope.disDiv = function() {
swal({
title: 'Are you sure?',
text: "You won't to display",
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, display it!',
cancelButtonText: 'No, cancel!',
confirmButtonClass: 'btn btn-success',
cancelButtonClass: 'btn btn-danger',
buttonsStyling: false
}).then(function() {
$scope.displayDiv=1;
});
};
【问题讨论】:
-
请不要在angularjs相关问题上使用angular标签
-
成功事件不在 Angular 世界中。用户 $scope.$apply
-
非常感谢'seyfside',它工作正常......
标签: angularjs sweetalert sweetalert2