用把手处理范围变量 [英] Handle scope variables with handlebars

查看:77
本文介绍了用把手处理范围变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用handlebars-1.1.2和旧的emberjs 1.5.1。



我只需要在label的for中放一个变量:

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

相反

 < label for =6> 

我得到

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

如果我只是在模板中使用{{queue.id}},它可以正常工作。 >

如何在html属性中传递该值?

解决方案

在此版本中的emberjs我应该写

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


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?

解决方案

In this version of emberjs I should write

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

这篇关于用把手处理范围变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆