Orange
Orange

Reputation: 119

How do i use ui-sref with multiple parameter

In ui-sref, i need to add two states like ui-sref="form.profile.retail and form.profile.corporate" , i am not sure how to do this, i have tried using conditional operator but didnt work.

In form.html

<a ui-sref-active="active" ui-sref="form.profile.retail"><span>2</span> Login</a>

Here is the Plunker

Thanks

Upvotes: 1

Views: 216

Answers (2)

michelem
michelem

Reputation: 14590

You can use ng-switch to determine what link to place, I cannot understand your conditional needs so I'll place only an example.

Assign a scope variable like isRetail to define when the link should be one or another:

<div ng-switch on="isRetail">
   <a ui-sref-active="active" ui-sref="form.profile.retail" ng-switch-when="true">Retail</a>
   <a ui-sref-active="active" ui-sref="form.profile.corporate" ng-switch-default>Corporate</a>
</div>

Upvotes: 1

brute_force
brute_force

Reputation: 1171

Try this :

 ui-sref="form({retail: form.profile.retail, corporate: form.profile.corporate})"

You can see this exmaple where multiple params are being passed : http://plnkr.co/edit/r2JhV4PcYpKJdBCwHIWS?p=preview

Upvotes: 0

Related Questions