AngularJS UI-Router : Get the absolute URL of the state with the parameters

前端 未结 3 575
既然无缘
既然无缘 2020-12-24 10:28

I wanted to be able to change the address\' URL without changing the state, as to prevent rerendering. From my search, ui-router currently does not provide this

3条回答
  •  不思量自难忘°
    2020-12-24 11:15

    You should use $state.href().

    1. To get the absolute URL you can then use:

      $state.href('user.home.view', {}, {absolute: true});

    2. To get the URL with the parameters in place you need to add them as the second argument

提交回复
热议问题