Skip to content

Instantly share code, notes, and snippets.

@frankiefu
Created April 30, 2015 23:37
Show Gist options
  • Save frankiefu/a907b471bf75fc1bbd95 to your computer and use it in GitHub Desktop.
Save frankiefu/a907b471bf75fc1bbd95 to your computer and use it in GitHub Desktop.
<dom-module id="x-app">
<template>
<template is="x-repeat" items="{{data.items}}">
<div>{{item.name}}</div>
</template>
<button on-click="updateItem">update item</button>
</template>
</dom-module>
<script>
Polymer({
is: 'x-app',
properties: {
data: Object
},
ready: function() {
this.data = {
items: [{name: 'foo'},{name: 'bar'},{name: 'zot'}]
}
},
updateItem: function() {
this.data.items[1] = {name: 'bar2'};
this.notifyPath('data.items.1', this.data.items[1]);
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment