polymer

Observe changes for an object in Polymer JS

夙愿已清 提交于 2019-12-19 02:49:23
问题 I have an element with a model object that I want to observe like so: <polymer-element name="note-editor" attributes="noteTitle noteText noteSlug"> <template> <input type="text" value="{{ model.title }}"> <textarea value="{{ model.text }}"></textarea> <note-ajax-button url="/api/notes/" method="POST" model="{{model}}">Create</note-ajax-button> </template> <script> Polymer('note-editor', { attached: function() { this.model = { title: this.noteTitle, text: this.noteText, slug: this.noteSlug } }

Rendering a content tag as part of a template in polymer and dart

蹲街弑〆低调 提交于 2019-12-18 19:33:18
问题 I wish to make a generic list using polymer and dart. I am extending the UL element to do so. I want to place template variables within the content of this custom element. <ul is="data-ul"> <li>{{item['first_name']}}</li> </ul> The custom element <polymer-element name="data-ul" extends="ul"> <template repeat="{{item in items}}"> <content></content> </template> <script type="application/dart" src="data-ul.dart"></script> </polymer-element> I was expecting the template variable to be

Bind a value between a parent and a child element where child element is created using javascript

做~自己de王妃 提交于 2019-12-18 17:53:32
问题 Using Polymer, does anyone know how to bind a value between a parent and a child element? Below is my attempt however it doesn't work. Note: child-component needs to be created using JavaScript. <dom-module id="host-component"> <template> <div>{{sharedValue}}</div> <div id="childComponentContainer"> <!-- CHILD-COMPONENT GETS CREATED HERE --> </div> </template> <script> Polymer({is:'host-component', properties:{ sharedValue:{ type: String, notify:true, observer: 'sharedValueChanged' } },

paper-button with type=“submit” within form doesn't submit?

霸气de小男生 提交于 2019-12-18 15:08:35
问题 I am trying to use paper-button with type attribute set to submit (as one would do with button element) to submit the enclosing form , but for some reason it is unable to submit the form. Is this a bug or feature? How to make paper-button submit the form? PS: I am in dart land (not js). 回答1: As noticed by Gunter, you can create a custom element which extends some of native element with your desired semantics. I encountered with your issue too and I've created simple element which gives

Why does Angular not need a dash in component name

落花浮王杯 提交于 2019-12-18 14:17:46
问题 I wondered why Polymer elements need a dash in custom elements name like <my-component> while this is not necessary for Angular components especially as Angular components also use ShadowDOM. ** Edit** It doesn't even seem to be suggested good practice in Angular. 回答1: The HTML spec allows you to use unknown tags ( <tab> , <panel> ) without the HTML parser throwing a fit. To their benefit, Angular uses this behavior for their directives to make the components like native. Tags that don't have

polymer form using paper-input and core-ajax

非 Y 不嫁゛ 提交于 2019-12-18 13:48:09
问题 i am working on a custom element that will serve as a form for sending map node data to a database using a restful service. i have 3 questions about this element. can this even work? i am trying to use a method which seems exactly the opposite of the direct data binding method when collecting data from a server. can this be used for sending to the server. in the core-ajax element i am using the auto="false" attribute. how would i go about calling the go() command when a use clicks the paper

Polymer + form POST data

六月ゝ 毕业季﹏ 提交于 2019-12-18 12:53:13
问题 I have this <form id="form_837299" class="appnitro" method="post" action="insert.php"> <paper-input label="Title" name="title" maxlength="255"> </paper-input> <paper-input floatinglabel multiline label="text" name="text"></paper-input> <li class="buttons"> <input type="hidden" name="form_id" value="837299" /> <input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" /> </li> </ul> </form> I have problem with POST data - nothing is sended in "text" and "title" (all in

How do you dispatch and listen for custom events in Polymer?

南楼画角 提交于 2019-12-18 11:53:49
问题 I want a child element to dispatch a custom event and the parent element to listen for it, and take some action. How do I do this when working with Polymer? 回答1: You can dispatch a custom event from a polymer-element like this: dispatchEvent(new CustomEvent('nameOfEvent')); Then, parent element can listen for the custom event like this: <child-element on-childspeaks="fireAway"></child-element> Here is a more complete example showing how this works. First, here is the code for the child

How to use Sass inside a Polymer component

假装没事ソ 提交于 2019-12-18 11:53:47
问题 I'm currently using Polymer as my front end development framework. I love SASS. Now I understand I can create a Sass file and import it like I normally would. However, I've really gotten into the habit of using style tags within my web components. Basically the workflow I am looking for is to be able to simply define a script tag within my Web Component maybe add type='sass; to it. Then have grunt go through and compile all of my SASS within those tags before outputting the files to my .tmp

Polymer Elements in a Meteor App

僤鯓⒐⒋嵵緔 提交于 2019-12-18 10:44:20
问题 Has anyone successfully added Polymer elements to a Meteor project? I'm struggling to make it work. I've tried using bower to install the Polymer package under public: ├── public │ ├── bower_components │ │ ├── platform │ │ └── polymer │ ├── elements │ │ └── my-element.html I then included the element like this: <head> <title>test</title> <script src="bower_components/platform/platform.js"></script> <link rel="import" href="elements/my-element.html"> </head> <body> ... <my-element></my-element