[英]Polymer Data-Binding will not replace
I have a polymer element that refuses to bind, and I can't figure out why. 我有一个拒绝绑定的聚合物元素,我不知道为什么。 The rendered output is just sending the raw {{varName}}
rather than replacing it with the appropriate value. 呈现的输出仅发送原始{{varName}}
而不用适当的值替换它。 However, formulas (with the [[fn(arg)]]
syntax) and binding to tags (with the $="{{varName}}
syntax) works fine. 但是,公式(使用[[fn(arg)]]
语法)和绑定到标签(使用$="{{varName}}
语法)可以正常工作。
Any idea what could be causing this? 知道是什么原因造成的吗?
Here is the template: 这是模板:
<dom-module id="hex-grid-element">
<template>
<link rel="stylesheet" type="text/css" href="hex-grid-element.css"></link>
<div id="grid"></div>
<br>
<div id="count">Count: {{hexes}}</div>
</template>
<script src="hex-grid-element.js"></script>
</dom-module>
You need to put your data inside a span: 您需要将数据放入跨度内:
"The binding annotation must currently span the entire content of the tag. String concatenation is not supported inside a tag, and the tag can't contain any whitespace" “绑定注释当前必须跨越标签的全部内容。标签内不支持字符串串联,并且标签不能包含任何空格”
see: Polymer Documentation on binding to text content 请参阅: 有关绑定到文本内容的Polymer文档
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.