polymer

What is the best way to implement declarative collection rendering with Polymer?

混江龙づ霸主 提交于 2019-12-04 17:19:36
I would like to be able to render a remote collection fetched with <core-ajax> as such: <rendered-collection url="/api/items"> <custom-element value="{{ _it_ }}"></custom-element> </rendered-collection> where <rendered-collection> would look something like: <link rel="import" href="/core-ajax/core-ajax.html"> <polymer-element name="rendered-collection" attributes="url" noscript> <template> <core-ajax url="{{ url }}" response="{{ collection }}" auto handleAs="json"></core-ajax> <template repeat="{{ _it_ in collection }}"> <content><!-- cannot be used like that unfortunately --></content> <

Polymer 1.0: iron-pages not switching pages with children events

大城市里の小女人 提交于 2019-12-04 17:06:26
I have a parent component with two children components in an "iron-pages" component. The parent should switch pages when it receives an event from one of the children. The problem is, when the event arrives at the parent component, it executes the code to switch children but nothing happens. But, if the code is executed on the parent component itself, then it works. My question is: Why the parent component is unable to switch pages when a child sends an event? Below is the code for the two child components: // this is "child-comm.html" <link rel="import" href="bower_components/polymer/polymer

polymer 1.0 how to central justify the paper-card heading?

青春壹個敷衍的年華 提交于 2019-12-04 15:32:36
I am trying this to central justify the paper card heading: paper-card [heading]{ @apply(--center-justified); } but it does not seem to help. kindly suggest heading is not an attribute so you cannot write like that. You basically need to style the .title-text element inside the shadow dom, so use this instead - paper-card::shadow #shadow .header .title-text { display: flex; justify-content: center; } Or use the polymer iron-flex-layout - paper-card::shadow #shadow .header .title-text { @apply(--layout-vertical); @apply(--layout-center); } Update Thanks to @sfeast for pointing it out. Since

Polymer 2.0: Notify and reflect to attribute

青春壹個敷衍的年華 提交于 2019-12-04 14:29:46
I'm new to this framework and would love to see some useful and simple examples of notify and reflect to attribute properties being put to use. Please keep the examples simple or add explanation for whatever code you provide. Notify: can be set to True|False. Let's say you have parent-element and child-element . Working example parent-element.html: <dom-module id="parent-element"> <template> <child-element foo="{{test}}"></child-element> </template> <script> Polymer({ is: "parent-element", properties: { test: { value: "bar" } } }) </script> </dom-module> As you can see, we have 1 property

Dynamically created html import inside a polymer element (Version 1.0)

亡梦爱人 提交于 2019-12-04 14:13:33
Dynamically created html import inside a polymer element Does anyone know how to dynamically add a html import into a polymer element (version 1.0)? The code below doesn't seem to work and complains that the.. HTML element <link> is ignored in shadow tree. Does anyone know any way around this or know a better way? <!-- here is where the created import could go --> <dom-module id="my-component"> <!-- here is where I'd ideally like the import to be created --> <template> <div id="container"> <!--This is where my dynamically loaded element should be placed--> </div> </template> <script> Polymer(

Working with Polymer and requirejs

穿精又带淫゛_ 提交于 2019-12-04 13:45:38
问题 In an attempt to create polymer elements that use requirejs modules I ran into a blocking issue. I understand that polymer is not designed to work with requirejs, but for the time being It is my only option. Searching for answers I found two solutions: Don't use requirejs and make your modules compatible with HTML imports. Put Polymer() call inside the requirejs callback as described here Since I have to use require, at least for the time being, I went with the solution no.2. However, it

Polymer 1.0: How to pass an event to a child-node element without using <iron-signals>?

点点圈 提交于 2019-12-04 13:26:34
问题 This Stack Overflow answer suggests using <iron-signals> to broadcast an event down the DOM tree to a custom element. Below, I ask a different question. Question How do I: pass an event down to a direct child node (custom element) from a parent (custom element) without using <iron-signals> ? Code This is what I have so far. But it doesn't work. parent-element.html <dom-module id="parenet-element"> <template is="dom-bind"> <child-element></child-element> <paper-button on-tap="_handleTap"><

Polymer and PHP

南楼画角 提交于 2019-12-04 13:09:12
问题 Hi I am just beginning to learn Polymer. I collect data as below using PHP. I can embed this in a DIV and display some data but I would like to make this bit of code into a Polymer element with parameters that I can import and the json data also into an external Polymer element that I can use to populate the page. I am struggling to get started, I know this is basic but if anyone has a pointer to get me on my way that would be great. <?php $host="host"; $username="username"; $password=

Polymer paper-dialog position

别来无恙 提交于 2019-12-04 11:47:46
In my application I am using polymer's paper-dialog element. The dialog's styles always position it in the center, but I want it to have a minimum distance set between the dialog and the right side of the window, so when the window shrinks, the paper-dialog won't get closer to the right side, than the set distance. Is there any way that I can do it with CSS, or shall I use some other technic? if you want to specified a distance between the dialog and the right side you might want to affect the property right of your paper-dialog with a fixed position like following : html /deep/ .dialog-right

grunt-bower-task and Polymer

匆匆过客 提交于 2019-12-04 10:59:50
I cannot seem to find an easy way to copy all the files from Polymer to using grunt-bower-task . grunt.initConfig({ bower: { install: { options: { targetDir: 'wwwroot/lib', layout: 'byComponent', install: true, copy: true, verbose: true, cleanTargetDir: false, bowerOptions: {} } } } I understand that only the main files defined inside each element's bower.json file get copied over. I am also aware that I could put a exportsOverride section in my own bower.json to include more files like this - "exportsOverride": { "*": { "": "*.*", "demo": "demo/*.*", "test": "test/*.*" } } But this doesn't