Reputation: 3852
I am trying to add parameters to ui-sref. If I try this it works perfectly
<a ui-sref="services.test({ id: 2 , other_id: 3 })">test</a>
But If I try this it don't work
<a ui-sref="services.test({ id: firstexmple , other_id: secondone })">test</a>
Upvotes: 0
Views: 116
Reputation: 7201
If you try to set the id
to literal value "firstexample" and other_id
to "secondone" you need to write them as you would write strings in plain JavaScript code, so:
<a ui-sref="services.test({ id: 'firstexmple' , other_id: 'secondone' })">test</a>
(mind that you can't use double quotes (like this id: "firstexmple"
) because you're already using them as to wrap the whole ui-sref
attribute's value.
Upvotes: 0