Skip to content

Instantly share code, notes, and snippets.

@frankiefu
Created May 23, 2015 02:20
Show Gist options
  • Save frankiefu/71d0810090384f9b4fa6 to your computer and use it in GitHub Desktop.
Save frankiefu/71d0810090384f9b4fa6 to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<title></title>
<meta charset="utf-8">
<script src="../../../polymer/components/webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="x-foo.html">
</head>
<body>
<template is="dom-bind">
<x-foo type="default" items="{{items}}"></x-foo>
<template is="dom-repeat" items="{{items}}">
<div>{{item.name}}</div>
</template>
</template>
</body>
</html>
<link rel="import" href="../../../polymer/components/polymer/polymer.html">
<dom-module id="x-foo">
<script>
Polymer({
is: 'x-foo',
properties: {
type: {
type: String,
value: 'default',
observer: '_typeChanged'
},
items: {
type: Array,
notify: true
}
},
_typeChanged: function() {
var items = [];
for (var i=0; i<10; i++) {
items.push({name: i});
}
this.items = items;
}
});
</script>
</dom-module>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment