我正在使用Ember(版本1.7.1),我需要绑定输入的值并拥有一个占位符,这是一个FontAwesome图标 . 在Ember(我知道)绑定值的唯一方法是使用内置的帮助器 . 但是这会导致占位符被转义,“&#xF002”就像那样显示文本 .
如果您使用的是Ember,则需要将输入占位符的CSS设置为FontAwesome的font-family . 这是SCSS(使用Bourbon for the placeholder styling):
input {
width:96%;
margin:5px 2%;
padding:0 8px;
border:1px solid #444;
border-radius: 14px;
background: #fff;
@include placeholder {
font-family: 'FontAwesome', $gotham;
}
}
如果您只是使用把手,如前所述,您可以将html实体设置为占位符:
如果使用Ember将占位符绑定到具有unicode值的控制器属性 .
在模板中:
{{text-field
id="listFilter"
placeholder=listFilterPlaceholder
value=listFilter}}
在控制器上:
listFilter: null,
listFilterPlaceholder: "\uf002"
并且值绑定工作正常!