polymer

Linking 2 custom elements through parent

泪湿孤枕 提交于 2019-12-11 14:08:33
问题 I have 2 custom child elements that I am trying to pass data between through a parent element. My code in the parent html looks something like this: <dom-module id="parent-html"> <template> <child-elem1 id="ch1"></child-elem1> <child-elem2 id="ch2"></child-elem2> </template <script> window.addEventListener('WebComponentsReady', function() { class WebApp extends Polymer.Element { static get is() { return 'web-app'; } static get properties() { return { } } ready () { super.ready(); this.$.ch1

Data binding in Polymer - function is being removed from bound object

淺唱寂寞╮ 提交于 2019-12-11 13:57:53
问题 I'm encountering an issue binding an object that contains a function from angular to Polymer 1.0. The function is not being passed through into the target object in the custom element. Here is a simplified code sample: The custom element has a single property named myprop: <script> Polymer({ is: 'my-custom-element', properties: { myprop: Object }, attached: function () { var x = this.myprop.x; //this is ok this.myprop.myfunc(); //myfunc is not defined! } }); </script> Here is the HTML: <div

Polymer: How to distinguish between finger tap or mouse click for “on-tap”?

夙愿已清 提交于 2019-12-11 13:55:27
问题 I have an element that has hover state (overlay). On desktop this works fine, however since there is no such thing as a mouseenter , I am making it so that tapping the overlay will show the other div. Therefore, I don't want the on-tap handler to get called when I tap on the element on my desktop. On my iPhone device when I tap on the element, this is what I get back: On my desktop browser I get this: In my mocha tests, I get something completely different when I call actionCardOverlay

Routing in polymer 1.0

你离开我真会死。 提交于 2019-12-11 13:41:40
问题 I am new to web development and building an application using polymer 1.0.4. I am using the page.js routing similar to the example in start kit. Now many of the custom element that I built are using ajax and periodically refresh the data. The problem with page.js routing that It seems it loads all custom elements even if the element is not viewed by user. so all custom elements are loading the data even if it is not needed. my questions: 1- How could I fix this so the the elements load data

How to access details of a swiped paper-card in iron-swipeable-container

不问归期 提交于 2019-12-11 13:29:40
问题 I have a swipeable-container with a dom-repeat (firebase data) <iron-swipeable-container id="teamchat"> <template is="dom-repeat" items="[[tcmmessages]]" as="tcmmessage"> <paper-card id="tcmcard" class="swipe item blue" data-index$="[[tcmmessage.__firebaseKey__]]"> <div class="card-content"> <b>[[tcmmessage.teamname]]</b> <paper-icon-button style="color: red;" on-tap="_startChat" icon="communication:chat"></paper-icon-button><br> [[tcmmessage.beitrag]]<br> <span class="chatmetadata">von [

Polymer, paper-datatable styling of rows

蓝咒 提交于 2019-12-11 13:25:42
问题 I'm trying to colour the rows of paper-datatable using the attribute customRowStyle This Plunk of paper-datatable is working, rows are colored, but it's not enclosed as separate Polymer element. I need to enclose paper-datatable in separate element. Need some help to fix this: how to make customRowStyle(item) to get called on table render and pass the item ? <paper-datatable data="{{data}}" custom-row-style="{{generateRowCss}}" on-row-tap="row_tap"> <paper-datatable-column header="title"

Is there a common way to get a polymer element's dataset or attributes?

99封情书 提交于 2019-12-11 13:22:36
问题 I used "paper-input" and "paper-button" in my own polymer element, since the e.target is not the element which bind the dataset and attributes, the way to get dataset in event handler is different. Is there a common way to get a polymer element's dataset or attributes? <dom-module id="login-form"> <template> <div> <form action="/login" method="POST"> <paper-input id="username" > <paper-icon-button on-click="clearInput" data-elmid="username" suffix > </paper-icon-button> </paper-input> <paper

Polymerfire - creating data after an event

橙三吉。 提交于 2019-12-11 13:18:45
问题 I'm using the firebase/polymerfire package from bower bower install firebase/polymerfire how can i create some data in the database after a method has been triggered? The document tag looks like it will display and update data. I would like to, when a user signs up, create some data for the user to use. app.signInAnonymously = function() { this.error = null; this.$.auth.signInAnonymously(); // add default data for the user template }; How can i use the default set() or push methods like the

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

Polymer how to update filtered array

百般思念 提交于 2019-12-11 12:48:51
问题 I have a filtered dom-repeat array in Polymer like this: <dom-module id="my-element"> <template id="template" is="dom-repeat" items="[[rows]]" filter="filter"> <span on-click="updateItem">[[item]]</span> </template> </dom-module> <script> Polymer({ is: "my-element", ready: function() { this.rows = ['abc', 'def', 'ahi', 'jkl']; }, filter: function(item) { return item.indexOf('a') > -1; }, updateItem: function(event) { var index = this.$.template.indexForElement(event.target); this.set('rows.'