Explain JavaScript in the polymer framework of the notification interaction _ Basic knowledge

Source: Internet
Author: User

The

Polymer defines a property that has a listening requirement as an accessor property (a property without listening requirements is still a normal attribute-form definition). In the template, you can also use the "::" syntax to synchronize an attribute bidirectional to an event in the target element, which is the concept of bidirectional binding in angular, even more pure and close to the principle.
properties defined in properties that do not have a notify and are not used in the template are not listening for requirements, so they are defined as normal properties. Otherwise, it will be defined as an accessor property, and the following example explains the problem
run

<script> var polymer = {dom: ' Shadow '}; </script>
<base href= "http://www.web-tinker.com/share/"/>
<link rel= "import" href= "polymer" /polymer.html "/>

<dom-module id=" Demo-test ">
 <template>
   
 

A property with Notify True is set to produce a property name-changed"event when it is changed. Note that the attribute name and changed are linked with the crossbar, and the changed is the past tense, not the change prototype. Polymer can use listeners to add event sniffing, but not directly to a function, but must be bound to a property name (I don't understand why it is designed).
Run

<script> var polymer = {dom: ' Shadow '}; </script>
<base href= "http://www.web-tinker.com/share/"/>
<link rel= "import" href= "polymer" /polymer.html "/>

<dom-module id=" Demo-test ">
 <template>
   
 

Events can be captured in the template using "::" > Falay, and these events include the notification event that is generated above and the interactive event that the user actively triggers.
Run

<script> var polymer = {dom: ' Shadow '}; </script>
<base href= "http://www.web-tinker.com/share/"/>
<link rel= "import" href= "polymer" /polymer.html "/

<dom-module id=" Demo-test ">
 <template>
  <input value=" {{text::input}} " /> 
 

Note that the above is style$= "[CSS]" instead of the direct style= "CSS", because this is the attribute assigned to the element, rather than the pure property assignment. So add a "$" in front of the equals sign (actually I think this syntax looks very strange).
These are all the things that I know about data binding in polymer. There may be omissions, which may be supplemented in other articles.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.