angular.js - How to solve the error x is undefined when using angluar ng-repeat in the flask environment?
迷茫
迷茫 2017-05-15 16:57:19
0
4
701

In the flask environment, whether you use angluar's ng-repeat; or vue's loop to traverse v-repeat, v-for; such an error will be reported, please solve it

<ul>
    <li ng-repeat="x in time">
    {{x.medicine}}
    </li>
</ul>

Error message:

jinja2.exceptions.UndefinedError
UndefinedError: 'x' is undefined
迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(4)
给我你的怀抱

It looks like this. Jinja’s template uses {{}} to output variables, and angluar does the same. So when you want to output a variable, you have to consider who outputs it. If it is angluar output, you need to compare it. Bracket escaping, output the curly braces into html instead of being filtered out by the template engine

仅有的幸福

http://jinja.pocoo.org/docs/dev/api/#jinja2.Environment

Ty80

http://lorenhoward.com/blog/how-to-get-angular-to-work-with-jinja/

phpcn_u1582

Just write it like this

{% raw %}
<ul>
    <li ng-repeat="x in time">
    {{x.medicine}}
    </li>
</ul>
{% endraw %}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template