双括号 [[ ]] 与聚合物中的双括号 {{ }} [英] Double Brackets [[ ]] vs Double Braces {{ }} in Polymer
问题描述
解释双括号([[...]]
)和双括号({{...}}
)之间区别的简洁方法是什么?聚合物 1.0?
例如,在
元素:
<iron-ajax url="data.json" last-response="{{data}}" auto></iron-ajax><iron-list items="[[data]]" as="item"><模板><div>名称:<span>[[item.name]]</span>
模板></iron-list>模板>
为什么 data
在一个地方被双大括号包围(last-response="{{data}}"
)但被双括号包围(items="[[data]]"
) 在另一个地方?
绑定可以是单向(使用 [[]])或双向(使用 {{}},但也可以使用通知).
>
解释*-way绑定想想流量.单向绑定是当您更新模型时,视图会更新.反之亦然,则为双向绑定.
有关详细信息,请参阅文档.
What's a succinct way to explain the difference between double brackets ([[...]]
) and double braces ({{...}}
) in Polymer 1.0?
For instance, in the documentation for the <iron-list>
element the sample HTML shows:
<template is="dom-bind">
<iron-ajax url="data.json" last-response="{{data}}" auto></iron-ajax>
<iron-list items="[[data]]" as="item">
<template>
<div>
Name: <span>[[item.name]]</span>
</div>
</template>
</iron-list>
</template>
Why is data
bounded by double braces in one spot (last-response="{{data}}"
) but bounded by double brackets (items="[[data]]"
) in another spot?
Binding can be either one-way (using [[]]) or two-way (using {{}}, but also use notify).
To explain *-way binding think traffic. one-way binding is when you update model, the view gets updated. When the vice-versa is also true it is a two-way binding.
For more information see the documentation.
这篇关于双括号 [[ ]] 与聚合物中的双括号 {{ }}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!