polymer-1.0

cannot changed the property of an object inside an array

陌路散爱 提交于 2019-12-25 08:01:41
问题 There is a parent element. One of its property is an array of objects. This array is initialised in the ready function. The display of this array is handed down to a child element. What I want to do is to update the quantity of each element in the array whenever the multiplier property changed. I tried to use the override dirty checking technique described in the docs but couldn't get it to work. I would appreciate some guidance. [plunker link][1] [1]: http://plnkr.co/edit

Polymer 1.x: Databinding Arrays

筅森魡賤 提交于 2019-12-25 04:32:38
问题 Objective I want to databind the selected property in this element to the DOM (at <div>[[selected]]</div> ). After selecting a state (like "Texas"), I expect the state's name to appear in the upper left next to the pre-selected states of "Colorado,South Dakota" (inside the <div>[[selected]]</div> tag). But instead, it does not. Question What's going on here? How can I successfully databind the DOM to the selected property? And have the DOM update automatically with each new state that is

How to call function defined inside Polymer Custom Element and pass arguments?

大兔子大兔子 提交于 2019-12-25 03:33:08
问题 I have html page using polymer builtin elements along with my customElement( my-form ) <dom-module id="my-form"> <template> <div> <paper-input id="inputName" label="Name" required error-message="Required Input" value="{{data.name}}"> Name </paper-input> <paper-input id="inputAge" label="Age" required error-message="Required Input" value="{{data.age}}"> Age </paper-input> <div class="rows layout horizontal"> <paper-button id='cancelBtn' tabindex="0">Cancel</paper-button> <paper-button id=

Polymer 1 and Firebase: How to deal with a large dataset with dom-repeat?

一曲冷凌霜 提交于 2019-12-25 02:47:16
问题 So, I am using firebase-query to read a dataset of about 9000 items. Then I am displaying the list of items with dom-repeat (with all sorts of filtering and sorting options). It all worked well when I tested it with 10 items or so, but now that I am reading the full dataset I have no idea how to manage it... the entire 9000 items are displayed, which obviously is not quite manageable. Here is a simplified version of what I have: <firebase-query path="/organisations" data="{{organisations}}"><

Iron flex layout: not getting the proper layout

ぐ巨炮叔叔 提交于 2019-12-24 20:50:29
问题 i am using iron flex layout https://www.webcomponents.org/element/PolymerElements/iron-flex-layout i wanted to align my div like a dashboard view but i am not able to align the boxes, i am using the layout standards https://github.com/PolymerElements/iron-flex-layout/blob/master/iron-flex-layout-classes.html mentioned here, no other iron flex styling is working other than layout inline layout-start The template look likes </custom-style> <style> .layout { background-color: #263367; padding:

Polymer 1.0: Data binding variable to <iron-meta> element (value attribute)

我的梦境 提交于 2019-12-24 17:28:25
问题 In Polymer 1.0, I am trying to data bind a string variable {{str}} to an <iron-meta> element (tag in parent element) as follows. This fails: <iron-meta id="meta" key="info" value="{{str}}"></iron-meta> The above code breaks. But the following code works (without the binding). This works: <iron-meta id="meta" key="info" value="foo/bar"></iron-meta> The difference is the variable version {{str}} fails and the constant version "foo/bar" works. Does anyone have a clue what is what is breaking the

How can I swipe between tabs using Polymer 1.0?

随声附和 提交于 2019-12-24 16:12:16
问题 I am using Polymer 1.0 and looking to create a tabbed layout where I can swipe between each tab I have. I have found a swipe-pages component, but the dependencies on the site state that it needs "polymer": "Polymer/polymer#^0.4.0" which does not work with the rest of my application. Are there any other components compatible with the latest version of Polymer (or at least Polymer 1.0)? Thanks 回答1: There is a Polymer 1.0 version. See https://github.com/slogger/swipe-pages. 回答2: I'm very new in

How do I get the `dom-if` to re-evaluate its `if` condition?

…衆ロ難τιáo~ 提交于 2019-12-24 10:47:41
问题 In my code below, the if condition is only evaluated at init. How do I get it to re-evaluate the condition whenever myType is changed? <dom-module id="media-element"> <template> <template is="dom-if" if="[[isType(0)]]"> .... </template> </template> <script> Polymer({ is: 'media-element', properties: { myType: { type: Number, value: 0 } }, isType: function(t){return (this.myType===t);} }); </script> </dom-module> 回答1: You could use a computed binding like this: <template is="dom-if" if="[

Reading data-attribute from element inside iron-list

时光总嘲笑我的痴心妄想 提交于 2019-12-24 10:36:50
问题 I create a list of divs using an iron-list like this: <iron-list items="[[chats]]" as="item" style="height:500px;"> <template> <div class="item title" data-recipient$="[[item.recipient]]"> <iron-icon class="big" src="../icons/games.svg"></iron-icon> </div> </template> </iron-list> I have a Polymer method which is called later-on and loops the div.title . I can then manage to set their color, but I can not manage to read out the data-attribute: var elems = document.querySelectorAll(".title");

Polymer 1.0 iron-ajax call is made but on-response does not fire and the data isn't bound

こ雲淡風輕ζ 提交于 2019-12-24 03:59:09
问题 I have the following code <link rel="import" href="../bower_components/polymer/polymer.html"> <link rel="import" href="../bower_components/iron-ajax/iron-ajax.html" /> <dom-module id="custom-Element"> <iron-ajax auto url="http://api.openweathermap.org/data/2.5/forecast" params='{"q":"California"}' handle-as="json" on-response="handleResponse" last-response="{{ajaxResponse}}"></iron-ajax> <span>{{ajaxResponse.city.name}}</span> <script> Polymer({ is: 'custom-Element', handleResponse: function