polymer-1.0

Parent element is ready before its child - Polymer 1.0

一曲冷凌霜 提交于 2019-12-24 03:55:12
问题 This question had been modified to match the actual problem. The original question mistakingly focused on iron-ajax, please see the original problem below. The question should have been: Please advice why child iron-ajax element is not ready during the 'ready' callback of my-component defined as follows: <dom-module id="my-component"> <template> <link rel="import" href="../../../bower_components/iron-ajax/iron-ajax.html"> <iron-ajax id="selectionLoader" url="" method="GET" handle-as="json"

Data binding in Polmyer's <test-fixture>

好久不见. 提交于 2019-12-24 03:06:13
问题 I am trying to test a custom Polymer element using their web-component-tester. Many of the examples make use of test-fixture. I would like to test my custom element using databinding, but I'm struggling to get data binding to work. Essentially, I want to take my custom element, assume that the variables are bound, and assert things about it. I'm trying to follow the example in the test-fixture README. Note also that I originally posted this question on their issue tracker before realizing

Polymer 1.0 - Responsive columns

半世苍凉 提交于 2019-12-24 02:13:50
问题 Here is what I want to achieve with Polymer Elements: Polymer Structure The column size is not always the same width but relative to the screen or warpper-div size. In example 1, it's each 16.66%, in example 2 it is 33.33%, in example 3 it should be 100%. I need a responsive layout where -dependent upon the screen size- a different number of columns is displayed per row and each of their column sizes will be adjusted. Does anyone know how I can achieve this with https://elements.polymer

Polymer 1.x: paper-dialog modal appears behind app-header-layout

纵饮孤独 提交于 2019-12-24 02:07:19
问题 I want to put a sub-element (child) inside an app-header-layout . The sub-element contains a paper-dialog modal . When I open the modal I expect to see the dialog box appear in front of the backdrop. Instead, the dialog appears behind the backdrop. How do I get the modal dialog to appear in front of the backdrop? Or is this perhaps a newly discovered bug in the app-drawer-layout or app-header-layout elements? Here is the plunk. ... http://plnkr.co/edit/ZjPHGqkt8vvDbFdF4CNn?p=preview index

Polymer 1.x: How to reset entire app after logout

天大地大妈咪最大 提交于 2019-12-23 23:18:24
问题 I have a Polymer app. When a user logs out, I want to reset the entire app to its original state. (Right now, when the user logs back in after logging out, the app returns the user to the app state and page they were on when they logged out.) Is there any convenient (i.e., global) app design or code pattern for accomplishing this? If there is nothing convenient/global, please show how to accomplish this locally (i.e., on an element-by-element basis). Edit After some research (and

Hosting Polymer app on web server with base URLs

倾然丶 夕夏残阳落幕 提交于 2019-12-23 19:15:30
问题 If I take the Polymer starter kit, it works well locally. I can navigate to http://localhost:8080/ and all the links to the 3 views work fine. Now, if I host this app on a web server (that is shared with other apps) on a URL such as http://myservername:8080/mywonderfulapp/, I am having trouble with the routing. Is there a way I can mention the app-route to take in the relative URL? I tried making changes to the html files to have relative URLs <link rel="import" href="./src/my-app.html"> <a

Autocomplete / Autofill with Polymer input elements (gold-email-input)

雨燕双飞 提交于 2019-12-23 17:52:12
问题 I'm having an issue getting Chrome's autofill and/or autocomplete working with Polymer input elements, such as gold-email-input. I've tried setting the autocomplete attribute of the gold-email-input component to on and I've also tried setting it to email . The autofill box appears, but selecting an entry from the autofill selections does not populate the control. What am I doing wrong? 回答1: <form is="iron-form"> <gold-email-input></gold-email-input> </form> This tends to work 回答2: You don't

Mocking Polymer imports

半腔热情 提交于 2019-12-23 15:38:11
问题 Is there a reliable way to mock imported dependencies in Polymer (or vanilla web components)? I checked this question and other resources where they suggest to previously define the mocked custom element. While this approach will actually mock the custom-element definition, it will not prevent the original dep to be imported later and its scripts executed ! This would surely lead to conflicts, inconsistences, and unwanted code execution where the dependencies do not just merely define an

Randomly failing polymer web component test

不想你离开。 提交于 2019-12-23 15:36:10
问题 Yet another attempt to marry Polymer with ES6 classes. And it almost works except a wct test failing randomly on a polymer component with an imported es6 class (by systemjs). As far as I understand, this happens because the script, containing class definition, gets loaded after mocha executed the test. The polymer component consists of two parts - html and javascript (to compile latter to es5), html: <dom-module id="my-test"> <template>hello</template> <script> System.import('elements/my-test

How to access functions defined in js file inside the template of Polymer element?

青春壹個敷衍的年華 提交于 2019-12-23 06:06:33
问题 I have created a function in global.function.js file as function getData(flag) { if (flag === 1) { return "one"; } else { return "not one"; } } which then is imported using custom-js-import.html element: <script src="global.function.js"></script> When I tried to access the above function in custom-element.html , I am able to access it in the script part but not in the template part. Is there any way I can access the function inside the HTML element? <!-- custom-element.html --> <link rel=