问题描述
由于我希望将AngularJS与Flask结合使用,所以我寻找了一个很好的工具来处理这些框架,因为Jinja和Angular会有彼此的问题。我发现这是非常酷,工作,但刚刚达到一定点。像这样的东西的作品,例如: < a ng-show =post.linkhref ={{post。链路|角}}>
{{post.title | angular}}
< / a>
但是另一方面,这是行不通的:
< span>
< a href =#/ posts / {{$ index | angular}}>评论< / a>
< / span>
当我尝试这样做时,我收到以下错误:
我做错了什么,或者只是在这种情况下,框架是有限的吗?帮助非常感谢。
正如错误信息所示, $
不能在中使用。
相反,您需要:
Since I wanted to use AngularJS in combination with Flask, I searched for a cool tool to handle these frameworks properly since Jinja and Angular would have problems with each other. I found Triangle which is pretty cool and working but just up to a certain point. Stuff like this works for example:
<a ng-show="post.link" href="{{post.link|angular}}">
{{post.title|angular}}
</a>
But on the other hand this does not work:
<span>
<a href="#/posts/{{$index|angular}}">Comments</a>
</span>
When I try to do that, I receive following error
Am I doing something wrong or is the framework just limited in that case? Help is highly appreciated.
As the error message is saying, $
cannot be used in Jinja as part of a variable.
Instead, you'll need to change Angular's delimiter notation:
这篇关于python Flask Triangle中的语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!