polymer-1.0

Polymer 1.0 - injectBoundHTML() alternative

醉酒当歌 提交于 2019-12-18 04:53:10
问题 What's the Polymer 1.0 equivalent to injectBoundHTML()? (i.e. appending HTML strings to nodes within a Polymer element and having data bindings resolve) A JSbin example - http://jsbin.com/jufase/edit?html,output EDIT: don't have enough SO cred to accept my own answer yet, but it should be down below somewhere. TL;DR - use "dom-bind" templates 回答1: Although as techknowledgey pointed out it's not really supported well yet. The following seems to do the trick. function injectBoundHTML(html,

How to use dom-repeat with objects instead of arrays in Polymer 1.0?

若如初见. 提交于 2019-12-17 04:29:13
问题 Iterating over an array myarray=[1, 2, 3] works like this: <template is="dom-repeat" items="[[myarray]]"> <span>[[item]]</span> </template> How can I iterate over an object myobject = {a:1, b:2, c:3} ? 回答1: Here is a complete implementation: <test-element obj='{"a": 1, "b": 2, "c": 3}'></test-element> <dom-module id="test-element"> <template> <template is="dom-repeat" items="{{_toArray(obj)}}"> name: <span>{{item.name}}</span> <br> value: <span>{{item.value}}</span> <br> <hr> </template> <

How can I dynamically add items into paper-dropdown-menu?

不问归期 提交于 2019-12-14 03:49:15
问题 I tried adding it with like dropdownMenu.appendChild(menuItem) but as I expected this doesn't work. I couldn't find information about this on Polymer's guides nor other similar questions on here. Is that possible? If so, how? paper-dropdown-menu: https://elements.polymer-project.org/elements/paper-dropdown-menu 回答1: In Polymer, recommended way of manipulating the DOM is by manipulating the data: put the list of menu items in array: var items_array = [....]; -create the menu as: <paper

Polymer, issue with binding array to paper slider value

孤者浪人 提交于 2019-12-14 02:53:03
问题 Here is example of the issue: Plunk The initial value, 31, is not binding when changing the slider. Array value 31 is seated on the initiation, but can not be reseated after change. How to properly bind slider to the array? <base href="http://polygit.org/polymer+:master/components/"> <script src="webcomponentsjs/webcomponents-lite.min.js"></script> <link href="polymer/polymer.html" rel="import"> <link href="paper-input/paper-input.html" rel="import"> <link href="paper-slider/paper-slider.html

Polymer Iron-form not submitting

别来无恙 提交于 2019-12-14 01:47:44
问题 I am using the iron-form in Polymer 1.0 to submit a login form with paper-inputs and a paper-button. I am calling submit() on the buttons onclick, but nothing happens. I even tried to put in a native button just to see if there was an error with my JS, but it still didn't submit. However, it did show the "----- is required" popup which it didn't do with the paper-button. I am using PHP to dynamically render the HTML, but i have also tried to make it work in a normal HTML file, which gave me

Can't find Python executable “/path/to/executable/python2.7”, you can set the PYTHON env variable

删除回忆录丶 提交于 2019-12-14 00:18:40
问题 bufferutil@1.2.1 install /home/sudthenerd/polymer-starter-kit-1.2.1/node_modules/bufferutil > node-gyp rebuild gyp ERR! configure error gyp ERR! stack Error: Can't find Python executable "/path/to/executable/python2.7", you can set the PYTHON env variable . gyp ERR! stack at failNoPython (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:401:14) gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:330:11 gyp ERR! stack at F (/usr/lib/node_modules

Dart app cannot find index.bootstrap.initialize.dart

让人想犯罪 __ 提交于 2019-12-13 14:05:34
问题 I am uncertain why, on attempting to start my app I get the following errors: debug GET http://localhost:63342/epimss_polymer_app/web/index.bootstrap.initialize.dart pub_serve Build error: Transform Reflectable on epimss_polymer_app|ReflectableTransformed threw error: The null object does not have a getter 'type'. NoSuchMethodError: method not found: 'type' Receiver: null Arguments: [] dart:core-patch/object_patch.dart 42 Object._noSuchMethod dart:core-patch/object_patch.dart 45 Object

Polymer 1.x: How to filter iron-data-table?

巧了我就是萌 提交于 2019-12-13 08:27:49
问题 How do I add a filter attribute to <iron-data-table ? (Please post a plunk demo.) I forked this plunk. Then I tried to add a filter by adding the following line: <iron-data-table ... filter="['item.user.name.first.length', '< 5']"> Which broke the plunk. Here is the new (now broken) plunk. The documentation here describes the filter attribute as follows: filter An array containing path/filter value pairs that are used to filter the items. But it lacks an example of how to use it. How do I add

How can do an (_?_:_) expression in polymer?

自作多情 提交于 2019-12-13 07:38:18
问题 I have something like this in JSP: <td>${job.invoiced ? "Y" : "N" }</td> How would I do something equivalent in Polymer 1.0: <td>{{job.invoiced ? "Y" : "N"}}</td> <!-- does not work --> 回答1: One way to solve the problem is to define a JS function called iff and then use that in your expression: <td>{{iff(j.invoiced, "●" ,"○")}}</td> Here is how I defined the iff function: <script> Polymer({ is: "job-audit", properties: { jobs: { type: Array, notify: true } }, iff(test,t,f){ return test?t:f; }

Polymer index property of type object with another property

﹥>﹥吖頭↗ 提交于 2019-12-13 07:10:13
问题 I have a custom element, x-custom , that has a property, object , that is an Object. I have another property, name , that I want to use to index object , to put data from other custom elements under a specific property of object . Something like the following is the end goal: <other-custom-element data="{{object.{{name}}}}"></other-custom-element> ... name: { type: String, }, object: { type: Object, value: {} } So, in the example, if the value of name is "prop1", then the data from other