Last active
February 25, 2016 15:27
-
-
Save Alos/ea00c53a9fa841009f68 to your computer and use it in GitHub Desktop.
Polymer Behaviour Question
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="../../bower_components/polymer/polymer.html"> | |
<link rel="import" href="../../bower_components/iron-selector/iron-selectable.html"> | |
<dom-module id="my-element"> | |
<template> | |
<style> | |
:host { | |
display: block; | |
} | |
</style> | |
<div>Hello from <span>{{items}}</span></div> | |
</template> | |
<script> | |
(function() { | |
'use strict'; | |
Polymer({ | |
is: 'my-element', | |
properties: { | |
//nothing to see here | |
}, | |
//by adding this behavior here it means that this element has the 'items' attribute among other things | |
behaviors: [Polymer.IronSelectableBehavior], | |
ready:function(){ | |
console.log(this.items);//my items should be here but no... nothing :( | |
} | |
}); | |
})(); | |
</script> | |
</dom-module> |
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
//somewhere else where I can inspect myarray and confirm that is has "things" in it | |
<my-element items="[[myarray]]" selected="0"></my-element> |
Sorry, it took so long..work got in the way! Please have a look:
https://jsbin.com/kazide/edit?html,console,output
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use bit.ly/polybin as a starter