polymer-1.0

Bind angular 2 model to polymer dropdown

瘦欲@ 提交于 2019-11-28 11:31:00
I decided to take some time this weekend to look at Angular 2 and Polymer. I'm really interested in angular 2 and would really like to start building something with it. One downside with starting with Angular 2 now is that there is no good component library yet. However, since Angular 2 claims that it should work so good together with Web Components I thought of giving Polymer a try. I have succeeded to bind data to simple components like an input field. What I'm stuck at for the moment is how to bind a model to the selected object of a paper-dropdown-menu. Since I'm very new into both I don't

Browser compatibility of Polymer

牧云@^-^@ 提交于 2019-11-28 10:45:33
问题 I am starting to use Polymer 1.0: the only thing I tried is a simple template like this: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <script src="bower_components/webcomponentsjs/webcomponents.min.js"></script> <script src="bower_components/webcomponentsjs/webcomponents-lite.min.js"></script> <link rel="import" href="bower_components/polymer/polymer.html"></link> <link rel="import" href="bower_components/iron-icons/iron-icons.html"> <title>Polymer test1</title> </head> <body

How to use commas in a CSS variable fallback?

时光怂恿深爱的人放手 提交于 2019-11-28 08:06:32
问题 How can one use commas in the fallback value of a CSS variable? E.g. this is fine: var(--color, #f00) , but this is weird var(--font-body, Verdana, sans-serif) . The idea is to be able to set a font-family using a variable with a fallback value of say Verdana, sans-serif . Edit: This actually works pretty well for browsers that support CSS properties, but the issue seems to come from Google Polymer's polyfills. For future reference, I ended up using variables for both the font and the font

Polymer 1.x: Modal paper-dialog appears behind its backdrop

你离开我真会死。 提交于 2019-11-28 07:34:50
Does anybody have any advice for fixing the problem of a modal appearing behind its backdrop? So far, I have tried making sure I have all the necessary imports (including <paper-dialog-scrollable> ). I also tried a "hack-fix" ( suggested by someone ) involving setting z-index: auto in the css of paper-header-panel . Neither works. It's worth noting that the <paper-dialog> tag works just fine. Until I add the modal attribute. Any ideas? Similar issues Appearing around the internet are this issue report and this Stackoverflow question . my-element.html <script src="http://www.polymer-project.org

Polymer 1.0 - Binding css classes

心不动则不痛 提交于 2019-11-28 07:27:30
I'm trying to include classes based on parameters of a json, so if I have the property color, the $= makes the trick to pass it as a class attribute (based on the polymer documentation ) <div class$="{{color}}"></div> The problem is when I'm trying to add that class along an existing set of classes, for instance: <div class$="avatar {{color}}"></div> In that case $= doesn't do the trick. Is any way to accomplish this or each time that I add a class conditionally I have to include the rest of the styles through css selectors instead classes? I know in this example maybe the color could just

Polymer Dom-Repeat Binding to Content

亡梦爱人 提交于 2019-11-28 06:53:44
In polymer 1.2.3, Is it possible for a dom-repeat to use content as a template and bind values to the elements provided? Custom Element: <dom-module id="modify-collection"> <template> <div> <template is="dom-repeat" items="[[collection]]"> <content></content> </template> </div> </template> </dom-module> Usage: <modify-collection collection="{{things}}"> <list-item resource="[[item]]"></list-item> </modify-collection> I've looked at the following resources without help: Polymer: How to watch for change in <content> properties Polymer 1.0 template bind ref equivalent Data-binding between nested

How to install Polymer 1.x templates with polymer-cli

不问归期 提交于 2019-11-28 06:13:46
问题 When I run polymer init , it only shows V2 templates, but I want V1. How do I install Polymer 1.x application/element templates? 回答1: There's a pending issue (polymer-cli Issue #804) to restore the 1.x templates. In the meantime, you can manually install them with: npm i -g justinfagnani/generator-polymer-init-polymer-1-element \ justinfagnani/generator-polymer-init-polymer-1-application This will allow the 1.x templates to be listed when running polymer init . 来源: https://stackoverflow.com

How to querySelector elements of an element's DOM using Polymer

半世苍凉 提交于 2019-11-28 03:25:33
问题 I have my element : <dom-module id="x-el"> <p class="special-paragraph">first paragraph</p> <content></content> </dom-module> and I use it like <x-el> <p class="special-paragraph">second paragraph</p> </x-el> in my imperative part: Polymer({ is: 'x-el', ready: function () { /* this will select all .special-paragraph in the light DOM e.g. 'second paragraph' */ Polymer.dom(this).querySelectorAll('.special-paragraph'); /* this will select all .special-paragraph in the local DOM e.g. 'first

How to style a <paper-input> tag in Polymer 1.0

别来无恙 提交于 2019-11-27 22:06:12
How do you style the <paper-input> tag in Polymer 1.0 Can you show how to specifically custom style the label text color, the underline color, input text color, and how to access them using custom-style ? Mikael E. Wikner You can change the appearance of <paper-input> by changing the custom properties listed over here (The information has been moved for the most recent version - it is available for versions older than v1.1.21). Here's an example: <style is="custom-style"> :root { /* Label and underline color when the input is not focused */ --paper-input-container-color: red; /* Label and

Is it possible to conditionally display element attributes using Angular2? [duplicate]

旧街凉风 提交于 2019-11-27 19:21:46
This question already has an answer here: How to add conditional attribute in Angular 2? 6 answers I have some code that uses Polymer attributes on elements, for example: <paper-drawer-panel force-narrow> The way polymer works is that I can't simply say force-narrow="false" if I want to disable the attribute, it has to be removed altogether. Is there a way in Angular2 to conditionally remove the entire attribute? I can't seem to find any information on this topic. I could use ngIf and repeat the entire element with and without the attribute but I would rather not if possible. Thanks! Edit -