Skip to content

How do I pass an expression to ui-sref? #745

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
gigablox opened this issue Jan 7, 2014 · 3 comments
Closed

How do I pass an expression to ui-sref? #745

gigablox opened this issue Jan 7, 2014 · 3 comments

Comments

@gigablox
Copy link

gigablox commented Jan 7, 2014

Let's say I need dynamic ui-sref

<div ng-repeat="panel in panels">
  <a ui-sref="panel.state" class="thumbnail">
    <h2>{{ panel.name}}</h2>
  </a>
</div>

Where my panels look like:

{
  name:'Contact General',
  state:'contact.general'
},
{
  name:'Contact Other',
  state:'contact.other'
}

Is it possible to pass the object property into the ui-sref directive?
From the docs it seems like it only accepts strings.

@mfield
Copy link

mfield commented Jan 7, 2014

see #395
it's not possible right now but not very hard to roll your own directive.

@timkindberg
Copy link
Contributor

Yeah that's a dupe of #395

@SanjanKalsi
Copy link

SanjanKalsi commented Mar 7, 2018

Just append '' to the state ("panel.state+''") and voila, its done (works for me :) )"

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

4 participants