2

I have an angular app in which there's a table that includes something of the general form:

<tr ng-repeat='d in data'>
<td>{{d.foo}}</td>
</tr>

I'd like to use the value of d.foo (which, for example, could be Bicycle to turn the cell into a link to a website like http://en.wikipedia.org/wiki/Bicycle. I've tried to find an answer to this on SO already but have had no luck; my apologie if I just didn't see it.

Is it possible to do the described task? If so, any pointers or suggestions?

3
  • Do you mean : <td><a ng-href="http://en.wikipedia.org/wiki/{{d.foo}}">{{d.foo}}</a></td> ? Commented Jul 24, 2013 at 10:49
  • Wow, yes, that's exactly it. Thanks a bunch, Cherniv. Commented Jul 24, 2013 at 10:51
  • Really? I've posted it like answer , if so! Commented Jul 24, 2013 at 10:52

2 Answers 2

3

Use:

<td><a ng-href="http://en.wikipedia.org/wiki/{{d.foo}}">{{d.foo}}</a></td>

You can read more here: http://docs.angularjs.org/api/ng.directive:ngHref
;)

Sign up to request clarification or add additional context in comments.

Comments

2

Use it in a <a> tag. For example:

<a href="http://your_url/{{d.foo}}">{{d.foo}}</a>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.