2016-05-27 20 views
0

私のコードでは、進行状況バーが表示されてから数秒(5秒)遅れて特定のモーダルポップアップを表示します。

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) { 

ただし、タイムアウトが正しく機能していません。 5秒前に閉じて、ポップアップを表示します。私は間違って何をしていますか?

私は既に$ timeoutを注入しました。

ありがとうございます。

答えて

1

はこれを試してみてください。

$timeout(function() { 
    myApp.hidePleaseWait() 
}, 5000); 
0

あなたは$timeoutではなく、機能自体にmyApp.hidePleaseWait()の結果を渡しています。これを試してみてください:

$timeout(myApp.hidePleaseWait, 5000);