logo
down
shadow

2 way data-binding between a polymer component and a model?


2 way data-binding between a polymer component and a model?

By : Green Coffee Bean Ma
Date : November 23 2020, 01:01 AM
wish helps you Before using Polymer, I would like to check that it's possible to do a 2 way data-binding between a component and a javascript model. I read the data-binding section on the website but this point is still not clear to me. , Yes, it's possible. Here you have an example, with a simple model:
code :
<template is="auto-binding">
  <paper-slider min="10" max="200" value="{{audio.volume}}"></paper-slider>
  <h1>Current volume: {{audio.volume}}</h1>
</template>

<script>
  var audio = {volume: 42, stereo: true, title: "A beautiful song"};

  var template = document.querySelector('template[is="auto-binding"]');

  template.audio = audio

  template.status =0;
  template.statusIsOn = function(value) {
    if (value.status >0)
      return value.count;
    return 0;
  };
</script>


Share : facebook icon twitter icon
Data binding between two Polymer elements using polymer 1.0

Data binding between two Polymer elements using polymer 1.0


By : Hez
Date : March 29 2020, 07:55 AM
wish of those help If you include in the