40
rated 0 times
[
42]
[
2]
/ answers: 1 / hits: 48419
/ 7 Years ago, thu, july 6, 2017, 12:00:00
I have written following code, I want to call a code under Cancel button:
vm.saveGroup = function(){
SweetAlert.swal({
title: Name this Device Group,
text: Please provide a name that you want your device group to be saved under. Also, make sure that you already specified all needed filters before you save the list.,
type: input,
showCancelButton: true,
closeOnConfirm: false,
showLoaderOnConfirm: true,
inputPlaceholder: Device Group name
},
function(inputValue){
if (inputValue === false) {
return false;
}
if (inputValue === ) {
/*eslint-disable */
swal.showInputError(You need to write something!);
/*eslint-enable */
return false;
}
deviceGroupsFactory.saveGroup(inputValue, vm.filterOutput)
.then(function(response){
if (response.status == 200){
SweetAlert.swal(Device Group saved!, You should now see your device group on the list., success);
$state.go('main.template.devices.groups');
}
else {
SweetAlert.swal(Error!, response.statusText, error);
console.log('xxx');
}
});
});
}
but I cannot call cancel clicked. I was looking for in docs but cannot find the solution.
More From » angularjs