polymer

Polymer. Way to dynamically add or remove observer

对着背影说爱祢 提交于 2019-12-08 16:47:26
问题 Is there a way to add or remove observer not in the moment of element initing? I can define observer this way: observers: ['dataChanged(data.*)'] Can i remove this observer later or can I set this observer different way than that? 回答1: You can easily add an observer dynamically, either by: this._addObserverEffect("property", observerFunction); or this._addComplexObserverEffect("dataChanged(data.*)"); Removing is harder and Polymer does not provide a function to do this. Although you could

Is there a way to run angularJS app as polymer component?

走远了吗. 提交于 2019-12-08 15:58:36
问题 I am looking a way to include asynchronously angularJS application with it's own styles and views included to JS into Polymer component. To make some kind of iframe . If you have any ideas, suggestions or real-world examples, it would be really helpfull! 回答1: Finally, I found a solution on my own. Just needed to bootstrap angular application on the specific element to avoid conflicts in case it will run more than one application. And implemented ajax calling of the script. Example: <link rel=

How to install Polymer iron-elements using bower?

家住魔仙堡 提交于 2019-12-08 15:20:59
问题 How to install polymer iron and paper elements for Polymer 0.9 using bower? Tried using bower to install in a way similar to core-elements but fails. Migration guide doesn't provide any information on upgrading core/iron or paper elements. bower install Polymer/iron-elements#^0.9.0 bower iron-elements#^0.9.0 not-cached git://github.com/Polymer/iron-elements.git#^0.9.0 bower iron-elements#^0.9.0 resolve git://github.com/Polymer/iron-elements.git#^0.9.0 bower iron-elements#^0.9.0 ECMDERR Failed

Polymer back button doesn't work with hash routing

爷,独闯天下 提交于 2019-12-08 14:50:33
问题 Sup! Back button sometimes doesn't work with my polymer project. When i hit back button the page variable is steel the current page and i need to hit the button twice or three times to get it working for example i go to the /#/rules page from /#/home but it doesn't go back to /#/home once i press the back button the second or third time by the way it does go back to the main page. Here is my observer and router: properties: { page: { type: String, reflectToAttribute: true, observer: '

Polymer 1.0 template bind ref equivalent

时光总嘲笑我的痴心妄想 提交于 2019-12-08 12:33:09
问题 In Polymer 0.5, you could do: <template bind ref="howdyTpl"></template> ... <template id="howdyTpl">Howdy {{whatever}}</template> And the template with id 'howdyTpl' would get stamped where referenced in the ref attribute. How can I do something similar in Polymer 1.0? 回答1: Here's a custom element that does something similar. Polymer({ is: 'bind-ref', properties: { ref: { type: String, observer: 'refChanged', }, }, refChanged: function(newRef, oldRef) { if (oldRef != undefined) { this.

polymer 1.0 unit tests - how to bind properties to a child element?

笑着哭i 提交于 2019-12-08 11:26:44
问题 I created a "child" element that is used by my custom "parent" element. My child element tag looks like this in my "parent" element: <child-element fruits="{{fruits}}"></child-element> fruits is an array in my "parent" element and is not a property of my "child" element. In my "child" element I have the following: <template is="dom-repeat" items="[[fruits]]"> <paper-card>[[item.flavor]]</paper-card> </template> How can I write a unit test for my "child" element to see if the dom-repeat is

Manual bootstrap in Polymer

大城市里の小女人 提交于 2019-12-08 09:43:53
问题 Is there an imperative way to bootstrap Polymer, in the style of Angular bootstrap? The docs give details about individual elements lifecycle, but nothing about the framework itself. I'm looking for a way to reconcile Polymer with requirejs and I need to force a single point of entry into my app. If I can bootstrap Polymer from within the requirejs data-main, I'm good. related material: - Working with Polymer and requirejs - Require.js to load all resources for an app, including Polymer -

Firebase syncing causes lag

回眸只為那壹抹淺笑 提交于 2019-12-08 09:35:09
问题 I am working on a project where I use Polymer in combination with Firebase. I have a knob element that is just a knob which value is stored in Firebase. The value of the knob is observed by a polymer observer, that when the value changes updates the firebase value. The problem is the following : when the value is changed in one place it updates the firebase value. This emits a change event to all other places. In other places this makes the value in the element being set and hence the

Flatten points into SVG polyline Polymer

笑着哭i 提交于 2019-12-08 08:01:46
问题 I have the following data structure: 'points': [ { 'x': 5535, 'y': 5535 }, { 'x': 5535, 'y': 60000 }, { 'x': 60000, 'y': 60000 }, { 'x': 60000, 'y': 5535 } ]; I would like to flatten it to 5535,5535 5535,60000 60000,60000 60000,5535 to use as a polyline points attribute. I have the following in Polymer <template> <polyline id="polygon", points="{{points | polygonPoints | toSvgPoints(width, height)}}" stroke="rgba({{colour.r}}, {{colour.g}}, {{colour.b}}, {{opacity}})" fill="rgba({{colour.r}},

Polymer2.0 - polymer testing is failing with error

不打扰是莪最后的温柔 提交于 2019-12-08 07:37:48
问题 When I try to test polymer elements and run polymer test command, I am getting below error Installing and starting Selenium server for local browsers ---------- selenium-standalone installation starting ---------- --- selenium install: from: https://selenium-release.storage.googleapis.com/3.0/selenium-server-standa lone-3.0.1.jar to: C:\Users\xxxx\AppData\Roaming\npm\node_modules\polymer-cli\node_modules\se lenium-standalone\.selenium\selenium-server\3.0.1-server.jar --- chrome install: from: