angular ui router 當視圖改變的時候url不會變,怎麼讓頁的url跟著一起變,急急急````
我也找了很久沒找到好的方法,用的window.location.href = ''
如果想用html5的新特性就設定html5mode
ui-router的路由是基于状态的,不是基于url的~
ui-router
url
ui.router視圖改變,那就是state改變咯
ui.router
js.config(function($stateProvider, $urlRouterProvider) { $urlRouterProvider .otherwise('/players?pagenum=1'); $stateProvider .state('players', { url: '/players?pagenum', templateUrl: 'tpls/players.html' }) .state('details', { url: '/details?playerId', templateUrl: 'tpls/details.html' }); });
js
.config(function($stateProvider, $urlRouterProvider) { $urlRouterProvider .otherwise('/players?pagenum=1'); $stateProvider .state('players', { url: '/players?pagenum', templateUrl: 'tpls/players.html' }) .state('details', { url: '/details?playerId', templateUrl: 'tpls/details.html' }); });
我也找了很久沒找到好的方法,用的window.location.href = ''
如果想用html5的新特性就設定html5mode
ui-router
的路由是基于状态的,不是基于url
的~ui.router
視圖改變,那就是state改變咯