Reputation: 259
I am using angular ui router.
But when I wrote a link to my current state, but with other parameters, the link is assembled wrong as you can see in the exapmle below. (The ID has changed in the options but not in the generated href attribute.
The id in the generated URL is the URL from the current.
<a ui-sref="root.app.list.detail"
ui-sref-opts="{'service':'ebBelegService','id':'463485'}"
class="ng-binding"
href="#/app/list/detail?service=ebBelegService&id=252237">
ebBeleg 463485
</a>
Is there a better way to solve it than build the URL manualy?
Upvotes: 0
Views: 506
Reputation: 9597
Don't use ui-sref-opts
for this. Instead pass the params as a second object to ui-sref
. Also, you shouldn't need the href object if you're using ui-sref
.
<a ui-sref="root.app.list.detail, {'service':'ebBelegService','id':'252237'}"
class="ng-binding" >
</a>
// Update
As i the comments i changed a little thing.
<a ui-sref="root.app.list.detail('service':'ebBelegService','id':'252237'})"
class="ng-binding" >
</a>
Upvotes: 1