Created
May 23, 2015 02:20
-
-
Save frankiefu/71d0810090384f9b4fa6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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