0
我已將ui-router v0.2升級到1.0.0,但是我的現有代碼存在一些問題。所以,我在官方文檔閱讀用1.0.0替換ui路由器0.2
$rootScope.$on('$stateChangeStart'
現在被替換爲$transitions.onStart({},
同樣與$rootScope.$on('$stateChangeSuccess'
與$transitions.onSuccess({},
到目前爲止好。但在我的原代碼,我有以下幾點:
$rootScope.$on('$stateChangeStart', function (event, toState, toParams, fromState, fromParams) {
// some code here
$state.go(toState.name, toParams);
}
我試過如下:
$transitions.onStart({}, function (toState, toParams) {
$state.go(toState, toParams);
}
但toState
和toParams
不可......我看了看文檔,但無法真正弄清楚什麼我應該在這裏做嗎?任何幫助將不勝感激。謝謝。
下面是官方1.0遷移指南:https://ui-router.github.io/guide/ NG1 /遷移到1_0 –