Handle scope variables with handlebars

折月煮酒 提交于 2019-12-24 16:53:36

问题


Using handlebars-1.1.2 and old emberjs 1.5.1.

I just need to put one variable in label's "for":

<label for='{{queue.id}}'>

Instead

<label for="6">

i get

<label for="<script id=" metamorph-51-start'="" type="text/x-placeholder">6<script id="metamorph-51-end" type="text/x-placeholder"></script>'&gt;<script id="metamorph-52-start" type="text/x-placeholder"></script>Очередь через личный кабинет<script id="metamorph-52-end" type="text/x-placeholder"></script></label>

If i simply use {{queue.id}} inside the template it works okay.

How can I pass that value inside html attribute?


回答1:


In this version of emberjs I should write

<label {{bind-attr for=queue.id}}>


来源:https://stackoverflow.com/questions/35728305/handle-scope-variables-with-handlebars

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!