2016-12-22 4 views
1

Учитывая мой код:

oneFunctionInController() { 
    $state.go('newState') 
    anotherFunctionInController() 
} 

anotherFunctionInController() { 
    let url = $location.url() 
    //do something based on url 
} 

проблема заключается в том, что, когда anotherFunctionInController() выполняется, URL я получаю до сих пор старый URL, а не «NewState»

В чем причина? любое решение? спасибо

ответ

1

Попробуйте это,

oneFunctionInController() { 
$state.go('newState').then(function(){ 
    anotherFunctionInController(); 
    }); 
} 
+0

это работает !!! спасибо –

+0

Примите ответ и вверх. –