Ui-router switching back to home state (url:"") doesn't change the url

Artur K.

Problem is that if I change back to index view with url: "" from any other state, the page content changes but not the url.

$stateProvider
    .state('index', {
        url: "",
        views: {
            ...
        }
    })
    .state('route1', {
        url: "/route1",
        views: {
            ...
        }
    })

So imagine being on *.com/route1 and clicking on the navbar logo back to index. The url still displays .com/route1 although I would expect the url to be .com.

I wanted to create a plunker, but there was no need since one of the most popular templates there already has the same issue: Plunker.

To see the issue you must go to preview mode from the top right corner (blue button). And go to Route 1 and back to Home. Look at the url.


I am quite sure that this has been asked somewhere but unfortunately I am not able to come up with the correct search term to find an answer.


Is this an issue with ui-router? Are there any known fixes to this problem?

Artur K.

Think I'm gonna solve this by making some "root" state urls absolute as described in this answer: Angular UI Router - Dynamic states get double slashes when navigated to with ui-sref.

Ui-router absolute states: Absolute Routes (^)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Angular UI Router doesn't get query params on url change

From Java

AngularJS UI Router - change url without reloading state

From Dev

UI-router change state without changing url

From Dev

Cannot change state from url bar with ui-router

From Dev

Can't navigate to ui-router state with URL

From Dev

UI-Router state.go call back on state change

From Dev

UI-Router: Change url without loading state or defer loading the state?

From Dev

Change a url parameter in the current state from ui-sref in angular-ui-router

From Dev

Change a url parameter in the current state from ui-sref in angular-ui-router

From Dev

UI-router abstract state with no url

From Dev

AngularJS / UI Router - Locale in State URL / TemplateURL

From Dev

angular ui router, back button does cause state change

From Dev

Prevent state change on back button with UI-Router

From Dev

In AngularJS ui-router, state changed, url changed but template url not

From Dev

In AngularJS ui-router, state changed, url changed but template url not

From Dev

Angular ui-router: Can you change state without changing URL?

From Dev

UI Router fails to update URL in address bar after successful state change

From Dev

UI-Router: Change part of the url

From Dev

angular-ui-router nested views the page doesn't loading when direct url is used or refresh

From Dev

angular-ui-router nested views the page doesn't loading when direct url is used or refresh

From Dev

UI-Router Let URL Pass when not defined in a state

From Dev

Angular UI-router default state on same URL

From Dev

AngularJS ui-router otherwise to state instead of url?

From Dev

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

From Dev

Updating url on transition from child to parent state in UI router

From Dev

stateParams in url of abstract state, ui-router, angularjs

From Dev

AngularJS ui-router default state for states without a URL

From Dev

Angular UI Router - Abstract Parent State with empty Url

From Dev

angular.js ui-router pass variable to state url

Related Related

  1. 1

    Angular UI Router doesn't get query params on url change

  2. 2

    AngularJS UI Router - change url without reloading state

  3. 3

    UI-router change state without changing url

  4. 4

    Cannot change state from url bar with ui-router

  5. 5

    Can't navigate to ui-router state with URL

  6. 6

    UI-Router state.go call back on state change

  7. 7

    UI-Router: Change url without loading state or defer loading the state?

  8. 8

    Change a url parameter in the current state from ui-sref in angular-ui-router

  9. 9

    Change a url parameter in the current state from ui-sref in angular-ui-router

  10. 10

    UI-router abstract state with no url

  11. 11

    AngularJS / UI Router - Locale in State URL / TemplateURL

  12. 12

    angular ui router, back button does cause state change

  13. 13

    Prevent state change on back button with UI-Router

  14. 14

    In AngularJS ui-router, state changed, url changed but template url not

  15. 15

    In AngularJS ui-router, state changed, url changed but template url not

  16. 16

    Angular ui-router: Can you change state without changing URL?

  17. 17

    UI Router fails to update URL in address bar after successful state change

  18. 18

    UI-Router: Change part of the url

  19. 19

    angular-ui-router nested views the page doesn't loading when direct url is used or refresh

  20. 20

    angular-ui-router nested views the page doesn't loading when direct url is used or refresh

  21. 21

    UI-Router Let URL Pass when not defined in a state

  22. 22

    Angular UI-router default state on same URL

  23. 23

    AngularJS ui-router otherwise to state instead of url?

  24. 24

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

  25. 25

    Updating url on transition from child to parent state in UI router

  26. 26

    stateParams in url of abstract state, ui-router, angularjs

  27. 27

    AngularJS ui-router default state for states without a URL

  28. 28

    Angular UI Router - Abstract Parent State with empty Url

  29. 29

    angular.js ui-router pass variable to state url

HotTag

Archive