1

Am trying to output some stuff in my template using directive ng-repeat and am not getting the right thing. Perhaps there is something am missing

<div ng-init="friends = [
{name:'John', age:25, gender:'boy'},
{name:'Jessie', age:30, gender:'girl'},
{name:'Johanna', age:28, gender:'girl'},
{name:'Joy', age:15, gender:'girl'}
]">

<li class="animate-repeat" ng-repeat="friend in friends" > {{friend.name}} who is {{friend.age}} years old. </li>

This is the output I get


who is years old.
who is years old.
who is years old.
who is years old.

What could I be doing wrong?

Alexxio
  • 1,091
  • 3
  • 16
  • 38

1 Answers1

0

This problem is because {{ variable }} is a language syntax of django template:

Variables look like this: {{ variable }}. When the template engine encounters a variable, it evaluates that variable and replaces it with the result.

But you need to output {{friend.name}} as it. If you're using django 1.5+, you can use {% verbatin %} block:

{% verbatim %}
    Your template here
{% endverbatim %}
Ye Liu
  • 8,946
  • 1
  • 38
  • 34