polymer-1.0

Polymer scroll to a specific div

北战南征 提交于 2019-12-11 12:52:34
问题 I am using Polymer Starter Kit, but what I need is that when I click in an element (link, buttom or similar) the page makes a scroll to a specific <div> in the same page, like when you use: <a href="specificID"> and goes to: <div id="specificID"> How can I do that in polymer? 回答1: Inside of your Polymer element's template, you should have your div that you wish to scroll to. Give your div some kind of id. For example: <div id="icecream"></div> . Polymer does a very convenient thing, where it

Returning undefined object from a firebase snapshot

你说的曾经没有我的故事 提交于 2019-12-11 12:42:53
问题 I implemented a function where I want to return an object saved under a certain url. In the code below, the first 'console.log(result);' returns the right object from the firebase location. The second one return undefined. Can somebody explain why and how to fix it? _getById: function(obj) { var url = "https://my-app.firebaseio.com/list/" + obj.groupId; console.log(url); var ref = new Firebase(url); var result = {}; ref.on("value", function(snapshot) { result = snapshot.val(); //first console

How to get rid of #text elelment when use polymer dom api

删除回忆录丶 提交于 2019-12-11 12:32:43
问题 Trying to instantiate template using Polymer.Templatizer behavior. Here is simple template: <template> <div> item </div> </template> Here is code that should create element from given template: //template variable was initialized from selectors in **create** event of component that uses this template this.templatize(template); var clone = this.stamp({}); console.log(clone.root); I was sure that root is pointer to template 's inner and single div element. But below is real output of console

Bindings when elements are bound to same object in memory

我怕爱的太早我们不能终老 提交于 2019-12-11 12:12:51
问题 I have a situation where I have multiple elements which are bound to the same path and thus the same JS object underneath. Because of this, changes to the object at one place are immediately visible by the other element (though it doesn't know it). The documentation says I need to manually alert the system about this or use a automatic binding, which I am. So a notifyPath call is happening. In the notifyPath DOM traversal it eventually nears the element which should react to the change,

Polymer V.1 how to concatenate some text to iron-list item that has json data e.g text{{data.somedata}}text

房东的猫 提交于 2019-12-11 12:11:04
问题 I'm Using iron-ajax with iron-list and for the iron-image i need to concatenate text to the image source that has {{item.path}} i tried this way <iron-image style="width:80px; height:80px;" sizing="cover" src="http://mydomain/{{item.path}}.jpg" preload></iron-image> But i get no image loaded and upon inspecting a list item it doesn't insert the path of the image coming from json data. src="http://mydomain/{{item.path}}.jpg" What is the way to concatenate the above by itself src="{{item.path}}

The paper-header-panel or the paper-drawer-panel won't take the whole top edges of the browser window

风格不统一 提交于 2019-12-11 11:55:54
问题 Hello I am studying Google's Polymer I followed their guide about Responsive Material Design Layouts But I just noticed that the paper-drawer-panel won't take the whole edge of the top part of the browser window. It has a bit of a gap. Here's my code <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Layout</title> <script src="bower_components

style not applied to dynamic content in polymer web-component

人盡茶涼 提交于 2019-12-11 10:51:11
问题 I recreate an h2-element here: <link rel="import" href="../../js/lib/polymer/polymer.html"> <dom-module id="x-custom"> <style> h2 { color: green; } </style> <template> <div id="content"> <h2>TEST</h2> </div> </template> <script> (function() { Polymer({ is: 'x-custom', ready: function() { this.$.content.innerHTML = '<h2>TEST 2</h2>'; this.updateStyles(); } }); })(); </script> </dom-module> If I skip the ready-function "TEST" is green, but not "TEST 2". Thought updateStyles() may fix this, but

Dynamically add page to Polymer iron-pages

落爺英雄遲暮 提交于 2019-12-11 10:10:57
问题 Is there any way to add a new page to iron-pages dynamically? I have this iron-pages: <iron-pages selected="0"> <div>Abc</div> </iron-pages> And then I add a couple more pages dynamically: document.addEventListener("WebComponentsReady", function() { var newDiv = document.createElement("div"); newDiv.innerHtml = "Def"; var ironPage = document.querySelector("iron-pages"); ironPage.appendChild(newDiv); console.log(ironPage.items.length) // log 1 instead of 2 ironPage.select(1) // nothing shown.

Transpiling a Polymer Element

假如想象 提交于 2019-12-11 07:28:53
问题 I'm scaffolding Polymer 1.x Elements using $ polymer init . These elements are not Polymer applications . They are just elements. All my elements are coded in ES6. I'd like to transpile my elements down to ES5. Considering that $ polymer build does not support single Element projects, what solutions can I use to achieve the above? 回答1: Transpiling Polymer to es5 is done in 3 steps: Vulcanize your element(s) by inlining the script and CSS: vulcanize element.html --inline-script --inline-css >

app-localize-behavior and nested template

[亡魂溺海] 提交于 2019-12-11 06:51:02
问题 How can I manage to use a behavior (Polymer.AppLocalizeBehavior) inside a nested template: the created scope hides the localize() function. <template> ... <div class="content"> <div class="card-container"> {{localize('greeting')}} <---- OK! <div class="layout horizontal wrap"> <template is="dom-repeat" items="{{employees}}"> <paper-card> <div class="card-content"> <h2>{{localize('greeting')}}</h2> <---- EMPTY.... Example appreciated. Thanks --nick EDIT 2016 May, 05 A small project showing the