0

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.

2 Answers 2

1

try this:

$timeout(function() {
    myApp.hidePleaseWait()
}, 5000);
Sign up to request clarification or add additional context in comments.

Comments

0

You're passing the result of myApp.hidePleaseWait() into the $timeout rather than the function itself. Try this:

$timeout(myApp.hidePleaseWait, 5000);

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.