Skip to content

Instantly share code, notes, and snippets.

@saeidzebardast
Created October 14, 2015 06:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saeidzebardast/e4fe878cf57eee51ce35 to your computer and use it in GitHub Desktop.
Save saeidzebardast/e4fe878cf57eee51ce35 to your computer and use it in GitHub Desktop.
Observe adding/removing elements of array in Polymer
<script>
Polymer({
is: 'observe-array-length',
properties: {
myArray: {
type: Array,
value: []
}
},
observers: ['_myArrayChanged(myArray.length)'],
_myArrayChanged: function (myArrayLength) {
console.log('Your array length is changed to ' + myArrayLength);
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment