search

Home  >  Q&A  >  body text

angular.js - angualr ui router how to change url

angular ui router url will not change when the view changes. How to make the url of the page change with it? Urgent Urgent````

phpcn_u1582phpcn_u15822825 days ago639

reply all(4)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-15 16:55:11

    I have been looking for a long time but haven’t found a good method. I use window.location.href = ''

    reply
    0
  • 淡淡烟草味

    淡淡烟草味2017-05-15 16:55:11

    If you want to use the new features of html5, just set html5mode

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-15 16:55:11

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

    reply
    0
  • ringa_lee

    ringa_lee2017-05-15 16:55:11

    ui.routerWhen the view changes, that means the state changes

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

    reply
    0
  • Cancelreply