polymer

How do you escape braces {{var}} in a polymer template?

不打扰是莪最后的温柔 提交于 2019-12-07 20:16:13
问题 How do you escape curly braces in a Polymer template? I've seen both of these as suggestions but they both throw "Invalid expression syntax" errors. {{ '{{' }}var{{ '}}' }} {{ '{{var}}' }} 回答1: How about {{'\{{var}\}'}} ? Seems to work. 回答2: To escape things like {{..asdf..}} or [[..asdf..]] in regular HTML code in the template use ­ in between: {­{..whatever..}­} 来源: https://stackoverflow.com/questions/24966597/how-do-you-escape-braces-var-in-a-polymer-template

Javascript: Converting Object of Objects to Array of Objects

萝らか妹 提交于 2019-12-07 19:01:38
问题 I'm working on a project using Polymer 1.0 and I want to use dom-repeat to list data from Firebase 3.0. In Firebase I have an object of objects like this: var objectofobjects = { "-KR1cJhKzg9uPKAplLKd" : { "author" : "John J", "body" : "vfdvd", "time" : "September 6th 2016, 8:11", "title" : "vfvfd" }, "-KR1cLZnewbvo45fDnEf" : { "author" : "JJ", "body" : "vfdvdvf", "time" : "September 6th 2016, 8:11", "title" : "vfvfdvfdv" } }; and I want to convert it to an array of objects like this: var

In polymer-dart how do I count inside a repeating template

血红的双手。 提交于 2019-12-07 17:17:03
问题 Say I've got a repeating template: <template bind repeat id='my-template'> This is the bound value: <span id="#myid[x]"> {{}} </span> </template> what can I replace [x] with that will be unique? Access to the loop counter would do the trick, but I'm open to suggestions. 回答1: I'm adding some utilities to Fancy Syntax (Polymer.dart's default binding syntax now) to help with this, but the basic outline is to run your collection though a filter that will add indices and return a new Iterable.

Numeric for loop in Dart Polymer templates

孤人 提交于 2019-12-07 16:56:04
问题 How do I write a numeric for loop in a polymer custom element template? I mean something like <template repeat="{{for i = 1 to 10}}"> <div>item</td> </template> Is it possible in the current version of Dart 1.0? 回答1: Currently no, this is not possible in Polymer.dart (or Polymer.js to my knowledge). The repeat binding requires an iterable (See Repeating Templates section of the Polymer_expressions library). Unfortunately due to Issue 12669 it is also not possible to use a list literal to

Using Polymer iron-ajax in repeating template

喜你入骨 提交于 2019-12-07 14:33:40
问题 How do I load a json file and use the data in a repeating template? This code doesn't produce anything: <dom-module id="name-list"> <template> <iron-ajax auto url="names.json" handleAs="json" lastResponse="{{data}}"></iron-ajax> <template is="dom-repeat" items="{{data}}"> <div>First name: <span>{{item.firstName}}</span></div> <div>Last name: <span>{{item.lastName}}</span></div> </template> </template> </dom-module> <script> Polymer({ is: "name-list" }); </script> Here's my json file (Edit:

Dynamically inject shared styles in polymer element (polymer 1.2.3)

你说的曾经没有我的故事 提交于 2019-12-07 12:57:22
问题 I do have several nested polymer elements created by myself. Currently with using polymers shared styles I'm able to inject custom styling into other elements. Unfortunately this approach is restricted to static use. So at implementation time I do need to know which Element should use which shared style by import the shared style module with <link rel="import" href="my-shared-style.html"> and <style include="my-shared-style"></style> . But in my use case I do need to inject shared styles into

Accessing the parent context of a web component being either DOM or Shadow DOM

本秂侑毒 提交于 2019-12-07 09:35:31
问题 Context: I am carrying out tests about web component composition in different contexts. Particularly I am trying to relate several web component by getting access to one of them from another one by a searching process within the DOM / Shadow DOM of the involved components. Problem: Let's suppose we have a web component named x-foo requiring to access another one x-randgen . The latter component exposes business methods used by the former. In order to avoid a tightly coupled communication

polymer dart vs polymer js: does it matter when using the component?

好久不见. 提交于 2019-12-07 09:18:06
问题 I want to build a polymer component. I can build it using Javascript. I can build it using Dart. For the person using it (me, someone else), does it make a difference or is the polymer packaging hiding all the magic inside? 回答1: When you build it in JavaScript you should be able to use it in Dart. There are some problems and it might need some manual tweaking to make it work. This is work in progress and will become easier soon (for example bower support for Darts pub ). There is a package

How to use react inside a polymer component?

不问归期 提交于 2019-12-07 08:44:31
问题 It seems it could posible to use react inside a polymer web component but I couldn’t find a working example, only this, but it seems outdated. HTML <link rel="import" href="http://www.polymer-project.org/components/polymer/polymer.html" /> <polymer-element name="my-polymer" constructor="" attributes="name"> <template> <P>I AM {{name}}</P> <div id="reactContainer"></div> </template> <script type="text/jsx"> /** @jsx React.DOM **/ Polymer('my-polymer', { created: function(){}, ready: function()

Polymer HTML Import caching

試著忘記壹切 提交于 2019-12-07 08:19:02
问题 I want to make sure that the browser gets the latest version of my custom elements via HMLT import. Right now, I am attaching a version query string: e.g. <link rel="import" href="/dist/elements/my-element.html?v=12345"> This is a common practice for JS and CSS files, and I am wondering if this is valid approach for HTML Imports as well? 回答1: Yes, the same principles apply. As an example, take a look at the source of http://www.polymer-project.org/. At the time of this writing, it contains