polymer

Can't remove element from dictionary

筅森魡賤 提交于 2019-12-12 04:05:48
问题 Following my previous question : How get the value of this polymer element ?, I need to remove an element from a dictionary that I pass as an attribute when I import this custom element in another custom element. flow-element <script> Polymer({ is: 'flow-element', properties: { dict: { type: String, notify: true }, name: { type: String }, kind: { type: String } }, handleClick: function() { console.log('clicked: ' + this.name); // the output does work console.log('Dict before ::' + JSON

Polymer Firebase: Print async data

拟墨画扇 提交于 2019-12-12 04:03:21
问题 Trying out polymer 0.8 with firebase. I am not able to print data that is being bound asynchronously <dom-module id="card-user"> <template> <div>{{name}}</div> </template> </dom-module> The script tag looks like this Polymer({ is: 'card-user', properties: { name: { type: String, computed: 'getFirebaseName(id)' } }, getFirebaseName: function(id) { var ref = new Firebase('https://xxx.firebaseio.com/users/' + id + '/name'); ref.once("value", function(snapshot) { return snapshot.val(); },

Different current target using on-tap on paper-button with iron-icons

孤者浪人 提交于 2019-12-12 03:49:13
问题 Why current target on-tap is different using paper-button with iron-icons and paper-button without iron-icons ? <dom-module id="button-tap"> <template> <paper-button on-tap="_getData">without icon</paper-button> <paper-button on-tap="_getData"><iron-icon="icons:thumb-up"></iron-icon> with icon</paper-button> </template> </dom> The current target is paper-button if not using iron-icons (child element). How can I get paper-button as current target if using a child element? codepen.io 回答1: If

Polymer 1.0 element property object binding, maintain structure

空扰寡人 提交于 2019-12-12 03:45:36
问题 I want to create a custom element that takes a JSON object as input. <activity-tracker activity='{"title": "Lord Meowser", "description": "lala"}'></activity-tracker> The element itself looks like this <dom-module id="activity-tracker"> <style> :host { display: block; box-sizing: border-box; } </style> <template> <p>{{activity}}</p> <p>{{activity.title}}</p> </template> </dom-module> And the property binding properties: { activity: { title: { type:String, value: '...' }, description:{ type

advanced data binding in Polymer

旧巷老猫 提交于 2019-12-12 03:45:25
问题 i have a little problem that i can not solve on my own. I have custom element: <dom-module id="station"> <template> <country-iso-alpha3 id="country" selected={{country}}></country-iso-alpha3> </template> this custom element station has country property with CZE default value. if we look in country-iso-alpha3 : <paper-dropdown-menu> <paper-menu class="dropdown-content" attr-for-selected="type" selected="{{selected}}" > <paper-item type="CZE"> <span>CZE</span> </paper-item> <paper-item type=

Polymer Multiple Iron-Collapse

非 Y 不嫁゛ 提交于 2019-12-12 03:38:02
问题 The polymer docs aren't clear on how to create a multiple toggle using iron-collapse. Is there an easy way to get each item to toggle? I had a look at multiple iron-collapse not working, expands only first but I could not get it to work. Maybe something has changed in polymer since then. Below is an example of the code I am using. <div on-click="toggle"><paper-item><a class="paper-item-link"><strong>List Items</strong></a></paper-item></div> <iron-collapse id="collapse"> <div>Content</div> <

Why use function wrap for Polymer property value of type object?

丶灬走出姿态 提交于 2019-12-12 03:37:30
问题 When initializing a property to an object or array value, use a function to ensure that each element gets its own copy of the value, rather than having an object or array shared across all instances of the element. this is from the official polymer document my question here is why to not to share this default value across multiple instance as this default value will only be called once during initialization ?? <dom-module id="title-element"> <template> <h1 style$="background-color: {

Updating Polymer Component with data from outside the component

故事扮演 提交于 2019-12-12 03:36:37
问题 This should be a pretty normal task , and yet i am missing something . I am trying to integrate Socket.io with Polymer [ using the chat application ] - Deciding to change the MessageList and the individual messageItem as Polymer components . SocketIo exposes a customEvent to be thrown from server , which sends the message as data , which then is being assigned to a property on the custom element . This is the MessageList element . <link rel="import" href="/polymer/polymer.html"> <link rel=

:host styles have no effect

这一生的挚爱 提交于 2019-12-12 03:35:37
问题 I had a wokring app with some :host styles on custom elements built with Polymer 5.5. Now, I'm converting this to Polymer 1.0 but run into this weird issue: Styles defined with :host are not applied. For testing purposes I took the example right from the documentation: <dom-element id="my-element"> <style> :host { display: block; border: 1px solid red; } #child-element { background: yellow; } </style> <template> <div id="child-element">In local DOM!</div> <content></content> </template>

Polymer 1.x: Obtaining customStyles property value

别等时光非礼了梦想. 提交于 2019-12-12 03:19:42
问题 Here is my jsBin. The parent-element sets the value of the --custom-color property in the child-element . I want to get the value of that property from the JS in the child-element . Here is the documentation but I can not find it mentioned anywhere in there how to do this. Please provide a working example (jsBin) with your answer. <h4>http://jsbin.com/kevanicebu/edit?html,console,output</h4> <link rel="import" href="https://rawgit.com/Polymer/polymer/master/polymer.html"> <dom-module id=