2017-10-10 46 views
0

我認爲$state.reload()是異步運行的,我怎麼能在執行代碼之前等待它呢?

一樣,

$state.reload(); futureFunc();

$state.reload().then(futureFunc); 不會爲我工作。

+0

未來是不確定的 –

+0

@RomanC我已經更新。謝謝。 – xxx222

+0

爲什麼你應該等待,如果它異步? –

回答

0

你將得到一個回調$ state.go

所以,做這樣的事情

$state.go('wherever', {whenever: 'whatever'}).then(function() { 
    // Get in a spaceship and fly to Jupiter, or whatever your callback does. 
}); 
相關問題