Skip to content

fix(stateDirectives): call update route state on page load #2392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

maksad
Copy link

@maksad maksad commented Nov 25, 2015

The latest PR #2363 removed a line from stateDirectives.js. This creates an issue. More precisely, when the page is loaded the update() function is not called the way it is expected.
Let me clarify this on an example:
Lets assume that we have an abstract state private. The private state has children states: index and settings. With routes #/private and #/settings.
And we have a navbar:

<ul>
  <li ui-sref-active="{'active': 'private'}"  class="parent">Private</li>
  <ul>
    <li>
      <a ui-sref="private.index">main</a>
    </li>
    <li>
      <a ui-sref="private.settings">settings</a>
    </li>
  </ul>
</ul>

screen shot 2015-11-25 at 12 56 22

Here we assume that every time we are in the index and settings ui-router should append class .active to .parent element. But in fact it never appends it on page load. It only appends it when the user clicks <a ui-sref="private.index">main</a> or <a ui-sref="private.settings">settings</a> links. Thats because the update is never called on page load. This PR solves the issue.

@maksad maksad force-pushed the fix-ui-active-onload branch from 4b22189 to 1a8ce8e Compare November 25, 2015 11:03
@maksad maksad changed the title Call update route state on page load fix(stateDirectives): call update route state on page load Nov 25, 2015
@maksad maksad closed this Nov 25, 2015
@maksad maksad deleted the fix-ui-active-onload branch November 25, 2015 11:46
@maksad maksad reopened this Nov 26, 2015
@maksad maksad force-pushed the fix-ui-active-onload branch from 23e4635 to 1a8ce8e Compare November 26, 2015 07:58
@christopherthielen
Copy link
Contributor

Thanks for the PR! I merged #2447 because it also has a test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants