metalaureate
metalaureate

Reputation: 7732

Angular ui-router ui-sref-opts to update address bar

I have path params of the form:

/mask/:username

and I have ui-sref and ui-sref-opts for the form:

<a ui-sref="mask" ui-sref-opts="{username: '@myusername'}">Mask</a>

But when this link is followed, no username parameter is passed, and no location bar (Html5 mode on) parameter is updated.

I want the address bar result of following to be

/mask/@myusername

Much thanks for any ideas.

Upvotes: 4

Views: 2981

Answers (1)

PSL
PSL

Reputation: 123739

Expanding my comment to an answer. I am not sure about ui-sref-opts But you could pass the parameters as an argument to the state in the ui-sref itself, provided your route has that param configured.

Try:-

 ui-sref="mask({username: '@myusername'})"

Upvotes: 3

Related Questions