polymer-1.0

Polymer: manually submitting a form

微笑、不失礼 提交于 2019-12-01 17:28:42
In polymer I'm trying to manually submit a form. My form looks like this: <form id="myForm" on-submit="{{ submitForm }}"> <input class="text" value="{{ someValue}}"> <button type="submit">Submit</button> </form> And in the polymer object I have: submitForm: function(e) { e.preventDefault(); } Whenever I try to do the following: document.getElementById('myForm').submit(); the form totally ignores the on-submit attribute and posts the form to a new page. I'm building a on-screen keyboard for anyone wondering why I would want to do this. I need to submit the form whenever someone hits the enter

How to use Angular2 ngModel for Polymer paper-input? ERROR: No value accessor for '' [duplicate]

﹥>﹥吖頭↗ 提交于 2019-12-01 14:34:22
This question already has an answer here: Two-way binding in Angular 2 with NgModel and mutating bound property? 2 answers This is my first question, I'm using angular2.beta.8, polymer 1.0, typescript. I'm having a problem when I use ngModel data binding with polymer paper-input element Basically nothing more than an element with ngModel and variable in the class. Running that creates this error: No value accessor for '' I started to use polymers with angular 2 just recently, and maybe this is noobie question, but I can't seem to find any information covering this topic. I have searched for

Polymer 1.0 'array-style' path accessors, alternative to bracket notation in expressions

孤人 提交于 2019-12-01 11:36:35
The Polymer 1.0 documentation states: The path syntax doesn’t support array-style accessors (such as users[0].name). However, you can include indexes directly in the path (users.0.name). How would one get around this in setting the path dynamically, and obtain the same behavior as the following example using Polymer 0.5? This is specifically in the context of generating forms for a model defined by an Object. <template repeat="{{row in fieldset.rows}}"> <div layout horizontal flex> <template repeat="{{field in row}}" flex> <paper-field field="{{model.fields[field]}}" value="{{obj[field]}}"> <

Polymer: firebase DB not updating using firebase-element

五迷三道 提交于 2019-12-01 09:50:08
I'm trying to setup a firebase connection with Polymer 1.0: <link rel="import" href="/bower/firebase-element/firebase-document.html"> ... <firebase-document id='fstats' location="https://polymer-redux.firebaseio.com/stats" log="true" data="{{stats}}"></firebase-document> ... this.properties = { stats: { type: Object, observer: '_handleFirebaseStats', notify: true } ... _handleFirebaseStats(stats) { ... } Here is how my firebase db looks like: { ... stats: { count: 0 } } Now, inside the _handleFirebaseStats I receive { count: 0 } , that part works great. But I would also like to save data back

Can dynamically created Local/Light DOM in Polymer be processed to ensure correct bindings?

為{幸葍}努か 提交于 2019-12-01 06:49:58
Is it possible to modify local/light DOM from JS within a custom element in a way that would process bindings for thus dynamically added elements as if they were specified in template ? Please consider the following snippet (a part of a custom element): ... attached: function () { var node = document.createElement('div'); Polymer.dom(node).innerHTML = '[[_computedValue()]]'; Polymer.dom(this.$.container).appendChild(node); Polymer.dom.flush(); }, _computedValue: function() { return "some value"; }, ... What I would like to happen is for the added div to have its inner HTML equal to the value

Polymer 1 nested dom-if within dom-repeat not updating when data changes

£可爱£侵袭症+ 提交于 2019-12-01 05:49:12
How do you make dom-if templates within dom-repeat 's update when the data changes?? Example here http://jsbin.com/xatala/edit?html,output In the example the data changes after 1.5 seconds but the dom-if's inside the template aren't re-evaluated/rendered. You can see this in the console.log. The data has changed but the view isn't updated. How would you make this work and what is the reasoning behind it?! Goce Ribeski Here is example that works: http://jsbin.com/nejadibuju/edit?html,console,output <template is="dom-if" if="{{arrayItem(myItems.*, index, 'isGood')}}"> [[item.title]] is SOOO good

Can dynamically created Local/Light DOM in Polymer be processed to ensure correct bindings?

回眸只為那壹抹淺笑 提交于 2019-12-01 04:15:17
问题 Is it possible to modify local/light DOM from JS within a custom element in a way that would process bindings for thus dynamically added elements as if they were specified in template ? Please consider the following snippet (a part of a custom element): ... attached: function () { var node = document.createElement('div'); Polymer.dom(node).innerHTML = '[[_computedValue()]]'; Polymer.dom(this.$.container).appendChild(node); Polymer.dom.flush(); }, _computedValue: function() { return "some

How do I import Polymer elements into code playgrounds like plunker (plnkr.co), jsBin and jsFiddle?

若如初见. 提交于 2019-12-01 01:07:11
Question: In this Plunk , I want to import the Polymer 1.0 elements <paper-button> and <paper-menu> . How do I do that? In other words, what is the proper set of <script> and <link> tags and their respective src and href attributes that will allow my <paper-button> and <paper-menu> elements to properly function? Attempts: In the right margin, there is an option to search and import external libraries. I used that to search for Polymer 1.0 and I imported the following. <script data-require="polymer@1.0.0" data-semver="1.0.0" src="http://www.polymer-project.org/1.0/samples/components

How to sort an iron-list in Polymer 1.0?

假如想象 提交于 2019-11-30 23:00:58
I am looking to sort data in an iron-list (and also sort items as they are added into the data array). Sample (unsorted) json data: [ {"name": "Zebra"}, {"name": "Alligator"}, {"name": "Lion"} ] I have tried using the indexAs property to sort an iron-list as follows but the API isn't clear how to use it: <iron-ajax url="./data.json" last-response="{{data}}" auto></iron-ajax> <iron-list items="[[data]]" as="item" index-as="name" class="fit"> <template> <div> Name: <span>[[item.name]]</span> </div> </template> </iron-list> I'm not exactly sure if there's more native Polymer way to do this, but

How to set dynamic Meta Tags and Open Graph tags in polymer?

做~自己de王妃 提交于 2019-11-30 18:49:17
I have a polymer node site that I've been working on and can't figure out how to include dynamic meta tags and Open Graph tags. Jquery won't work and neither will using the polymer api to add a node because it will add all the tags after the page loads and facebook won't be able to read the tags. Google crawlers do render the page but it would be best if I could set the description in the header. <html> <head> <meta name="description" content="description goes here" /> <meta property="og:title" content="title"/> </head> <body> <group-pages id="grouppages" is="dom-bind"></group-pages> </body> <