[英]Polymer 1.0 auto binding templates
I am trying to get auto binding template to work with out success. 我正在尝试获取自动绑定模板,但无法成功。 This is what I have done so far. 到目前为止,这是我所做的。 The page doesn't render with the value of "greeting" . 该页面不使用“ greeting”的值呈现。 It outputs {{greeting}}. 输出{{greeting}}。
<!doctype html>
<html lang="">
<head>
<link rel="stylesheet" href="styles/main.css">
<script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="bower_components/polymer/polymer.html">
</head>
<body>
<template is="dom-bind" id="app" >
<span> {{greeting}} </span>
</template>
<script src="scripts/app.js"></script>
</body>
</html>
app.js app.js
(function(document) {
'use strict';
var app = document.querySelector('#app');
app.greeting = "Hello";
})(document);
It works with Polymer 0.5.5 http://plnkr.co/edit/fmL9xQEXKwnINzdL3rBj?p=preview 它适用于Polymer 0.5.5 http://plnkr.co/edit/fmL9xQEXKwnINzdL3rBj?p=preview
Your {{greeting}}
binding must be the only content of a tag ( Polymer documentation: Binding to text content ). {{greeting}}
绑定必须是标记的唯一内容( Polymer文档:绑定到文本内容 )。 You need to remove the surrounding whitespace: 您需要删除周围的空格:
<template is="dom-bind" id="app" >
<span>{{greeting}}</span>
</template>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.