Reputation: 5021
In My piece of code , I want to show a certain modal pop up only after a few seconds(5 seconds) of delay once the progress bar shows.
myApp.showPleaseWait(); //Shows the progress bar
TransactionApiServices.postUnmergeTransactionResearchDetails(researchParams).success(function (results) {
console.log("User have access");
$timeout(myApp.hidePleaseWait(),5000); //Show the bar for 5 seconds and then close it
getUnmergeResearchPopup($scope, $uibModal, $scope.detailData, $rootScope); //Open the pop up
}).error(function (result) {
but the timeout is not working properly . It closes before 5 seconds and shows the pop up. What am I doing wrong ?
I have injected $timeout already though.
Thanks in advance.
Upvotes: 0
Views: 104
Reputation: 5718
You're passing the result of myApp.hidePleaseWait()
into the $timeout
rather than the function itself. Try this:
$timeout(myApp.hidePleaseWait, 5000);
Upvotes: 0