I'm using Sweet alert for alert messages. I have confirmation alert box is there, after confirmation i have disable my content but that is not disable $scope
is not working inside swal()
if clicked twice it is working.how can i make it work.
My HTML Code:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="http://limonte.github.io/sweetalert2/dist/sweetalert2.css">
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.3.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js"></script>
<script type="text/javascript" src="http://limonte.github.io/sweetalert2/dist/sweetalert2.min.js"></script>
<script type="text/javascript" src="js/myscript.js"></script>
</head>
<body ng-app="app" ng-controller="myController">
Supplier ID:<input type="text" ng-model="supplierID" ng-disabled="disable"/><br>
Series ID:<input type="text" ng-model="seriesID" ng-disabled="disable"/><br>
SKU ID:<input type="text" ng-model="skuID" ng-disabled="disable"/><br><br>
<div class="action-keys">
<button class="btn btn-default" ng-click="enable()" ng-disabled="!disable">Enable</button>
<button class="btn btn-default" ng-click="disableCall()" ng-disabled="disable">Disable</button>
</div>
</body>
and my myscript.js
:
angular.module('app', [])
.controller('myController', function($scope) {
$scope.disable = false;
$scope.disableCall = function () {
swal(
{
title: 'Warning',text: 'Are you want to disable?',type: 'warning',showCancelButton: true,confirmButtonColor: '#3085d6',cancelButtonColor: '#d33',
confirmButtonText: 'Yes',cancelButtonText: 'No',confirmButtonClass: 'confirm-class',cancelButtonClass: 'cancel-class',allowOutsideClick : false
},function(isConfirm) {
if (isConfirm) {
$scope.skuID = '';
$scope.seriesID = '';
$scope.supplierID = '';
$scope.disable = true;
}else{
return;
}
});
}
$scope.enable = function () {
$scope.skuID = '';
$scope.seriesID = '';
$scope.supplierID = '';
$scope.disable = false;
}
});
This my sample code enable is working fine, disable function inside confirm not working. Please help on this. Thanks in advance.