angualr ui router 如何改变url


angular ui router 当视图改变的时候url不会变,怎么让页面的url跟着一起变,急急急````

angularui angularjs

FCSMio 10 years, 2 months ago

ui.router 视图改变,那就是state改变咯


 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'
        });
});

DPZ-LMZ answered 10 years, 2 months ago

ui-router 的路由是基于状态的,不是基于 url 的~

琐琐碎碎212 answered 10 years, 2 months ago

如果想用html5的新特性就设置 html5mode

无产光辉指 answered 10 years, 2 months ago

我也找了很久没找到好的方法,用的window.location.href = ''

双面维诺妮卡 answered 10 years, 2 months ago

Your Answer