Serving Polymer App to a /path not at root

The polymer-cli created apps came with assumption of serving from root level “https://stackoverflow.com/”. In generated project index.html you will find two comments <!– The `<base>` tag below is present to support two advanced deployment options: 1) Differential serving. 2) Serving from a non-root path. Instead of manually editing the `<base>` tag yourself, you should generally … Read more

What is the difference between Polymer elements and AngularJS directives?

You’re not the first to ask this question 🙂 Let me clarify a couple of things before getting to your questions. Polymer’s webcomponents.js is a library that contains several polyfills for various W3C APIs that fall under the Web Components umbrella. These are: Custom Elements HTML Imports <template> Shadow DOM Pointer Events others The left-nav … Read more

Polymer 1.0: How to pass an argument to a Polymer function from an attribute?

You could utilize HTML5 data attributes instead. Try like this: <paper-button id=”foo” on-tap=”bar” data-args=”foo,some other value,2″>Click</paper-button> … <script> (function() { Polymer({ is: ‘example’, properties: {…}, bar: function(e){ var args = e.target.getAttribute(‘data-args’).split(‘,’); // now args = [‘foo’, ‘some other value’, ‘2’] } }); })(); </script>

Polymer element with javascript dependencies

Private resources should be installed in your component folder and used directly. But shared resources, those resources that other components my also want to use (like marked), should be handled as dependencies. We suggest two conventions for handling shared dependencies: always use the canonical path which is ../<package-name> (you did this already). Polymer by convention … Read more

Registering a custom element from a chrome extension

For me it was sufficient to use @webcomponents/custom-elements package in my content.js. Also webcomponents-sd-ce.js weights about 80kb and custom-elements.min.js only 16kb. Just install it as a dependancy and import it in the content.js and let your package manager do the rest. npm i @webcomponents/custom-elements import ‘@webcomponents/custom-elements’ This is how I use it in my project … Read more