polymer-1.0

Databind iron-ajax JSON response entry to nested Polymer custom elements

天大地大妈咪最大 提交于 2020-01-06 03:20:06
问题 I've got a Polymer app running an iron-ajax call to a service that returns a json string: { "name": "John" } The Polymer code on the main page is: <link rel="import" href="/elements/my-form.html"> <dom-module id="my-app"> <template> ... <iron-ajax auto url="/grabData" handle-as="json" last-response="{{data}}"></iron-ajax> <iron-label> From iron-ajax = {{data.name}} </iron-label> <my-form></my-form> ... "my-form" is: <link rel="import" href="/my-name.html"> <dom-module id="my-form"> <template>

Polymer and globals

北城以北 提交于 2020-01-06 02:47:08
问题 I'm getting into Polymer and i like the deps resolution approach using imports. And i like the extending capability through the behaviors config. However, there's something that doesn't feel comfortable to me, about behaviors in particular. Looking at the PolymerElements code i see that behaviors, are defined inside their own html in the global object Polymer and then referenced directly when imported by another component.. For example: paper-button imports paper-button-behavior https:/

Polymer Routing with page.js do not add hashbang to URLs when links are opened in new tab

北战南征 提交于 2020-01-06 01:31:05
问题 I am using polymer starter kit which uses page.js for routing. The hashbang page option is set to true in routing.html // add #! before urls page({ hashbang: true }); when links such as <a href="/products/productname"></a> are clicked, the #! is added and the resulting url looks like this: http://localhost:3000/#!/products/productname but when the links are opened in a new browser tab, they look like this http://localhost:3000/products/productname . How can I have the #! added when links are

polymerfire-auth error “auth/popup-closed-by-user” 404 on popup redirect

房东的猫 提交于 2020-01-05 07:30:32
问题 I created a Firebase project based on Polymer Starter Kit and made some modifications to fix routing, but the sign-in popup immediately closes and logs an error: The popup has been closed by the user before finalizing the operation. The _authenticate function (in the code below) is called to authenticate the user. I was able to properly set it up both on Facebook and Google console, so I'm not sure what the error means. Here's my code: <dom-module id="my-app"> <template> !-- Firebase Setup --

Polymer data change doesn't reflect

折月煮酒 提交于 2020-01-04 10:02:19
问题 I'm trying to hide/unhide a UI element with a button in Polymer, but it doesn't work. I have the button and the element: <button id="runPredictionButton"> <i>Button text</i> </button> <px-card hidden$="{{hide}}"> //...content here </px-card> <div class="output"></div> And I defined the property and the event listener, too: <script> Polymer({ is: 'custom-view', properties: { hide: { type: Boolean, value: false }, }, ready: function() { var self = this; this.$.runPredictionButton

Polymer 1.0: Sorting dom-repeat

 ̄綄美尐妖づ 提交于 2020-01-04 05:48:04
问题 How do I sort the data in this jsBin by item.order. (Documentation) http://jsbin.com/zoqaqivaba/edit?html,output <html> <head> <title>My Element</title> <script data-require="polymer@*" data-semver="1.0.0" src="http://www.polymer-project.org/1.0/samples/components/webcomponentsjs/webcomponents-lite.js"></script> <script data-require="polymer@*" data-semver="1.0.0" src="http://www.polymer-project.org/1.0/samples/components/polymer/polymer.html"></script> <base href="http://element-party.xyz/"

Polymer 1.0 dynamic template with dom-repeat

醉酒当歌 提交于 2020-01-04 05:32:25
问题 I have a scenario where I would like to create dynamic template elements that will be used with Polymer's dom-repeat . My current prototype is the following (JSbin demo): var domRepeat = document.createElement('template', 'dom-repeat'); domRepeat.items = ['a', 'b', 'c']; var div = domRepeat.content.ownerDocument.createElement('div'); div.innerHTML = '[[item]]'; domRepeat.content.appendChild(div); document.body.appendChild(domRepeat); Polymer.dom.flush(); However , this does not work as

Polymer 1.0: Two-way data binding: <iron-form> to/from Firebase

倾然丶 夕夏残阳落幕 提交于 2020-01-04 05:20:01
问题 I want to two-way databind the field values of an iron-form to a Firebase node (representing user-defined settings , for example). settings.html <dom-module id="my-settings"> <template> <firebase-document location="[[firebaseUrl]]" data="{{form}}"> </firebase-document> <form is="iron-form" id="form"> <paper-checkbox id="history" name="history" on-change="_computeForm" >Save history </paper-checkbox> <!-- ... --> <!-- All types of form fields go here --> <!-- ... --> </form> </template>

Polymer nested app routes are not mapping correctly

末鹿安然 提交于 2020-01-04 04:38:05
问题 I am trying to get some basic routes right. I'm using Polymer 1.5.0 and I'm having problems using nested routes. I'm using app-route 0.9.2 As this post suggests, Polymer uses a decentralized approach in routing. Therefore I decided to do the following: <app-route route="{{route}}" pattern="/:page" data="{{data}}" tail="{{tail}}"> </app-route> <iron-pages selected="{{data.page}}" attr-for-selected="title" fallback-selection="404"> <pgarena-home-app title="" route="{{tail}}" ></pgarena-home-app

How to view the Polymerfire demo using Polymer’s `polymer serve` polyserve server?

喜欢而已 提交于 2020-01-03 16:25:43
问题 I want to view this demo of Polymerfire in my browser. I expect to see the demo run in my browser. Instead, I see a blank page and the following console error. console.log.error.message GET http://localhost:8080/ 404 (Not Found) Navigated to http://localhost:8080/ I used the following procedure: I installed the Polymer-CLI multi-tool per the instructions found here. I created a project using the Polymer Starter Kit (PSK). I named the project my-app . I installed the Github repo found here