Skip to content
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

feat(uiSrefActive): provide a ng-{class,style} like interface #2363

Merged
merged 1 commit into from
Nov 14, 2015
Merged

feat(uiSrefActive): provide a ng-{class,style} like interface #2363

merged 1 commit into from
Nov 14, 2015

Conversation

fpipita
Copy link
Contributor

@fpipita fpipita commented Nov 8, 2015

This pull request is based on the suggestion by @nateabele on issue #1431. It enables ui-sref-active to be passed an expression that should evaluate to an object hash with the activeClass and state properties. If state is provided, activeClass is applied to its element if the current active state includes state, even if state is abstract. It works even if ui-sref is found neither on the element nor on any of its children. Furthermore, if state is provided, it takes precedence over the state exposed by ui-sref. Hope it helps to close #1431 :)

@nateabele
Copy link
Contributor

Hey, sorry for not responding right away. After a belated internal discussion with @christopherthielen, we agreed an ng-class-style interface would be better, i.e. with class names as keys and state names/globs as the values, i.e. { active: "admin.*" } — I think that would provide a lot more flexibility and a lot less verbosity?

Would you be willing to update the PR to support that? If not, no worries, and sorry for the back-and-forth.

@fpipita
Copy link
Contributor Author

fpipita commented Nov 10, 2015

Hi, no problem at all about that! I definitely agree with you guys about the ng-{class,style} providing a cleaner interface.

I will update the PR in this week-end.

@nateabele
Copy link
Contributor

Awesome, thanks!

@fpipita fpipita changed the title feat(uiSrefActive): match on abstract states that are included by the current state feat(uiSrefActive): provide a ng-{class,style} like interface Nov 14, 2015
@fpipita
Copy link
Contributor Author

fpipita commented Nov 14, 2015

Hi, I've updated the PR to match the new requirements. Please, let me know if anything else needs to be done :)

nateabele added a commit that referenced this pull request Nov 14, 2015
feat(uiSrefActive): provide a ng-{class,style} like interface
@nateabele nateabele merged commit 539e207 into angular-ui:master Nov 14, 2015
@christopherthielen
Copy link
Contributor

Can we get another PR to merge to feature-1.0?

@fpipita
Copy link
Contributor Author

fpipita commented Nov 17, 2015

Hi, I've just opened PR #2375 which brings this feature into feature-1.0.

@shali3
Copy link

shali3 commented Jan 30, 2016

This is a great feature. you should really document it. I see no mention of this.

@maybenull
Copy link

Agree with @shali3, docs are missing this.

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.

ui-sref-active not working correctly with abstract and child states
5 participants