Skip to content

Target same route with different parameters in ui-sref #580

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
ghost opened this issue Nov 13, 2013 · 3 comments
Closed

Target same route with different parameters in ui-sref #580

ghost opened this issue Nov 13, 2013 · 3 comments

Comments

@ghost
Copy link

ghost commented Nov 13, 2013

I'm in my search route, where I have 3 different parameters setup, and I want to toggle between them. The problem is that if I'm on a state with ?agency=6, and in ui-sref I put ?advertiser=6, it appends the agency on it automatically. Is this by design or a bug? If by design, is their a way to override it? I saw that setting null works, but that's a bit cumbersome as I allow up to 10 parameters in this state.

<div><a ui-sref="search({ agencies: deal.agency._id })"><i class="fa fa-youtube-play"></i>{{ deal.agency.name }}</a></div>
<div><a ui-sref="search({ advertisers: deal.advertiser._id })"><i class="fa fa-money"></i>{{ deal.advertiser.name }}</a></div>
<div><a ui-sref="search({ externalusers: deal.salesPlanner._id })"><i class="fa fa-group"></i>{{ deal.salesPlanner.name }}</a></div>
@nateabele
Copy link
Contributor

By default, ui-sref inherits parameters from parent states when generating URLs and transitioning, since that's generally the desired behavior. Disabling this (and other things) has come up once before, however, and there are plans to add a companion attribute to tweak the behavior.

@ghost
Copy link
Author

ghost commented Nov 13, 2013

Alright, well I guess I'll try to just create an object from a scope function to pass the nulls for the other parameters until this gets added.

@nateabele
Copy link
Contributor

Alternatively, you could make a copy of this and roll your own directive: https://github.com/angular-ui/ui-router/blob/master/src/stateDirectives.js -- might be less effort.

Closing this as a duplicate of #376 to keep discussion in one place.

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

No branches or pull requests

1 participant