I am trying to update record using Angular js method my html is like,
<button type="button" ng-click="delete()">'Update'</button>
delete method calling on angular js is,
$scope.delete = function () {
tasksService.getData($scope.ids).then(function (d) {
var result = JSON.parse(d.data.data);
});
if (confirm("Sure to update status +'result.name'+ For building?")) {
}
}
This code gets call on click but moved to last line confirmation after clicking on OK
button later it call getData
method i get result in var result
Actually i need to show some data from result in Confirmation Text
Hopes for your suggestions thanks
Try to show the confirm message in the success of the getData(). This will make the control wait for the response of getData().
$scope.delete = function () {
tasksService.getData($scope.ids).then(function (d) {
var result = JSON.parse(d.data.data);
if (confirm("Sure to update status " + result.name + "For building?")) {
}
});
}