我有一個使用ui-router的AngularJS應用程序。所有的工作不錯,但我想有這樣的訪問用戶註冊確認屏幕:如何在沒有首先導航到index.html的情況下直接進入具有ui路由器的狀態
http://localhost:2757/Auth/confirmation
在我目前的配置,當我打開瀏覽器頁面,這個鏈接看起來不爲index.html,然後做不要進入/ Auth /確認狀態。我明白爲什麼會發生這種情況,但我不知道如何解決問題。
有人可以給我一些建議,如何/如果我可以做一個鏈接,將直接讓我到/認證/確認。
所有我能想到的也許是這樣的:
http://localhost:2757/index.html?load=AuthConfirm
然後以某種方式有一個檢查,檢測到一次的index.html加載了一個新的狀態過渡。
這裏是我的AppConfig文件:
var auth = {
name: 'auth',
url: '/Auth',
views: {
'root': {
templateUrl: 'app/auth/partials/home.html'
}
}
};
var authContent = {
name: 'auth.content',
url: '/:content',
views: {
'root': {
templateUrl: 'app/exams/partials/home.html'
},
'content': {
templateUrl: function (stateParams) {
return 'app/auth/partials/' + stateParams.content + '.html'
}
}
}
}
這裏的東西我想:
http://localhost:2757/index.html < <帶我到我的主索引頁沒有找到
http://localhost:2757/index.html/Auth < <返回頁面
http://localhost:2757/index.html/Auth/register < <返回頁面沒有找到
謝謝。在我的情況下,我已經在使用最新的路由器,所以我想我需要選擇onChangeConfig選項。你可以添加一個例子,說明如何使用它來滿足我的特殊需求,我想要使用/ Auth/confirmation來表示狀態。謝謝 – Alan2
會做,給我秒 –
也只是爲了確認。 app.config(stateConfig)的順序是什麼? app.config(onChangeConfig);哪一個應該先來。順便說一下,您是否有任何想法,以確定在下一個版本或最新的提交中,如果這些不起作用將會被修復。謝謝 – Alan2