I have set up within angular 1.5 the Ui-router as follows:
app.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/');
$stateProvider
.state('blank', { url:'/blank', templateUrl: 'home/blank.html' })
`enter code here` .state('verify', { url:'/verify/:type', templateUrl : 'update/verify.html', controller: function($scope, $stateParams, general) { general.verifyemail($stateParams.type);} })
.state('home', { url:'/', templateUrl: 'home/home.html' })
.state('about', { url:'/about', templateUrl: 'about/about.html' })
.state('faq', { url:'/faq', templateUrl: 'faq/faq.html' })
.state('exercise', { url:'/exercise', templateUrl: 'practice/exercise.html' })
.state('levels', { url:'/levels', templateUrl: 'practice/level.html' })
}]);
路由器的工作原理,當應用程序已經啓動,但如果你擴展的URL包括路徑,即MYAPP /約和URL粘貼到新的瀏覽器窗口,瀏覽器會打開該應用程序,但轉到主頁。如果將相同的URL粘貼到已加載的頁面中,則會進入正確的狀態。UI路由器不能正常工作的啓動
我明顯地設置它錯了,但我不明白爲什麼。
它應該是myapp#/ about no?除非你改變了這個。 – Walfrat
排序 - 非常感謝所有答覆 - 事實證明,我的js代碼已經聲明優先於url瀏覽器調用的調用。當您嘗試修改現有程序時,並不總是很容易知道代碼的其餘部分在做什麼! – user2942970