I am just submitting one form.Its taking some time to return the response,on that time I need to show the loader.
This is my code
<div id="page-loading">
<img style="display:none; margin:0 auto;" src="~/images/loader.gif" />
</div>
Script:
$scope.myFunc = function (leave) {
$scope.leaveDetails=leave;
console.log($scope.leaveDetails)
var requestHeaders = {
"content-type": 'application/json'
}
var httpRequest = {
method: 'POST',
url: '/Admin/sendRequest',
headers: requestHeaders,
data: $scope.leaveDetails
}
$http(httpRequest).then(function (response) {
$timeout(function () {
$('#page-loading').fadeOut('slow');
}, 1000);
alert("successfully applied")
window.location= "/admin/Home";
})
}
But its not displaying the loader But taking more time to return the response.
If I give display:block here, <img style="display:none; margin:0 auto;" src="~/images/loader.gif" /> by default loader is coming but I need to show it only on submit of form.
Any suggestion?