polymer-1.0

Polymer.js two-way binding to textarea value

瘦欲@ 提交于 2019-12-19 17:46:10
问题 In version 0.5 it was easy: <polymer-element name="textarea-tpl" attributes="value placeholder"> <template> <link rel="stylesheet" type="text/css" href="css/index.css"> <textarea id="textarea" value="{{value}}" placeholder="{{placeholder}}"></textarea> <textarea id="hidden_textarea"></textarea> </template> <script> Polymer({ ready: function() { var text = this.$.textarea; var hidden_text = this.$.hidden_textarea; text.onkeyup = function() { hidden_text.value = text.value + "\n"; var height =

Polymer 1.0 'array-style' path accessors, alternative to bracket notation in expressions

风流意气都作罢 提交于 2019-12-19 10:33:13
问题 The Polymer 1.0 documentation states: The path syntax doesn’t support array-style accessors (such as users[0].name). However, you can include indexes directly in the path (users.0.name). How would one get around this in setting the path dynamically, and obtain the same behavior as the following example using Polymer 0.5? This is specifically in the context of generating forms for a model defined by an Object. <template repeat="{{row in fieldset.rows}}"> <div layout horizontal flex> <template

Polymer 1 nested dom-if within dom-repeat not updating when data changes

会有一股神秘感。 提交于 2019-12-19 08:13:44
问题 How do you make dom-if templates within dom-repeat 's update when the data changes?? Example here http://jsbin.com/xatala/edit?html,output In the example the data changes after 1.5 seconds but the dom-if's inside the template aren't re-evaluated/rendered. You can see this in the console.log. The data has changed but the view isn't updated. How would you make this work and what is the reasoning behind it?! 回答1: Here is example that works: http://jsbin.com/nejadibuju/edit?html,console,output

Bind a value between a parent and a child element where child element is created using javascript

做~自己de王妃 提交于 2019-12-18 17:53:32
问题 Using Polymer, does anyone know how to bind a value between a parent and a child element? Below is my attempt however it doesn't work. Note: child-component needs to be created using JavaScript. <dom-module id="host-component"> <template> <div>{{sharedValue}}</div> <div id="childComponentContainer"> <!-- CHILD-COMPONENT GETS CREATED HERE --> </div> </template> <script> Polymer({is:'host-component', properties:{ sharedValue:{ type: String, notify:true, observer: 'sharedValueChanged' } },

ngModel Binding on Polymer dropdown (Angular2)

旧街凉风 提交于 2019-12-18 09:26:30
问题 Ok so far I was successfully able to bind <paper-radio> , <paper-checkbox> with ngModel by using a Custom ControlValueAccessor for each one of them. Now I'm stuck at <paper-dropdown-menu> Here the scenario, I can capture the paper-dropdown (iron-select) but cannot bind -two-way, i.e., using ngModel below is the HTML and custom accessor class My form.html <paper-dropdown-menu [(ngModel)]="mymodel.selection" label="Your Fix"> <paper-menu class="dropdown-content"> <paper-item value="1"

Polymer paper-dialog not centered

不问归期 提交于 2019-12-18 09:06:52
问题 In my polymer app, when I open a paper-dialog using an iPhone, it's not centered, as opposed to opening it using Chrome or Safari using the a desktop Mac or PC. I'm dynamically constructing the paper-dialog element and placing it in the DOM template using javascript, and then calling open() : var d = document.createElement('paper-dialog'); d.innerHTML = "<h2>Dialog Title</h2>" "<p>some content</p>"+ '<div class="buttons">'+ "<paper-button >More Info...</paper-button>"+ "<paper-button dialog

paper-input autocomplete fails to fill

我的未来我决定 提交于 2019-12-18 09:06:13
问题 Polymer 1.0 Chrome 50.0.2661.102 I am trying to enable chrome autofill with paper input. When selecting either input the standard appropriate chrome autofill prompt list appears, however selecting an available name, or email from the list does not populate the input, it just closes the chrome autofill list. <paper-input id="email" name="email" label="Email" type="email" autocomplete="email" ></paper-input> <paper-input id="password" name="password" label="Password" type="password"

Polymer, binding to array items not working

笑着哭i 提交于 2019-12-18 07:05:51
问题 In this example (Plunk) there is bind between property and array item. firstName should change from 'John' to 'Test' on click, but it's not happening. How to make the property to change on item update? <script src="http://www.polymer-project.org/1.0/samples/components/webcomponentsjs/webcomponents-lite.min.js"></script> <link rel="import" href="http://www.polymer-project.org/1.0/samples/components/polymer/polymer.html"> <!-- <link rel="import" href="https://cdn.rawgit.com/download/polymer-cdn

Double Brackets [[ ]] vs Double Braces {{ }} in Polymer

点点圈 提交于 2019-12-18 05:39:28
问题 What's a succinct way to explain the difference between double brackets ( [[...]] ) and double braces ( {{...}} ) in Polymer 1.0? For instance, in the documentation for the <iron-list> element the sample HTML shows: <template is="dom-bind"> <iron-ajax url="data.json" last-response="{{data}}" auto></iron-ajax> <iron-list items="[[data]]" as="item"> <template> <div> Name: <span>[[item.name]]</span> </div> </template> </iron-list> </template> Why is data bounded by double braces in one spot (

Data binding/updating between parent and child using <content> tag in Polymer1.0

喜夏-厌秋 提交于 2019-12-18 05:25:16
问题 I have a slider element that contains list of slides and a img to show hovered slide as shown below. I am binding currentImage between custom-slide (child) and custom-slider (parent) CASE I custom-slider.html <template> <div> <custom-slide current-image="{{currentImage}}"></custom-slide> <custom-slide current-image="{{currentImage}}"></custom-slide> <custom-slide current-image="{{currentImage}}"></custom-slide> </div> <img src="{{currentImage}}"> </template> It works perfectly when I used