search

Home  >  Q&A  >  body text

angular.js - How to solve the error x is undefined when using angluar ng-repeat in the flask environment?

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
迷茫迷茫2783 days ago703

reply all(4)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-05-15 16:59:19

    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

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-05-15 16:59:19

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

    reply
    0
  • PHP中文网

    PHP中文网2017-05-15 16:59:19

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

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-05-15 16:59:19

    Just write it like this

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

    reply
    0
  • Cancelreply