Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <title>polymer</title>
  <script src="https://rawgit.com/webcomponents/webcomponentsjs/master/webcomponents-lite.js"></script>
  <link rel="import" href="https://rawgit.com/Polymer/polymer/master/polymer.html">
</head>
<body>
  
<dom-module id="x-test">
  <template>
    <input value="{{filterText::input}}" placeholder="filter">
    <input value="{{filterText2::input}}" placeholder="filter">
    <template id="resultList" is="dom-repeat" items="{{ schedules }}" filter="filterRoom" as="schedule" index-as="scheduleId">
      <div>
        <span>{{scheduleId}}</span>: 
        <span>{{schedule.name}}</span>
      </div>
    </template>
  </template>
</dom-module>
  
<script>
  HTMLImports.whenReady(function() {
    Polymer({
      is: 'x-test',
      properties: {
        schedules: {
          value: function() {
            return [
              {name: 'Item A'},
              {name: 'Item B'},
              {name: 'Item C'},
              {name: 'Item D'}
            ]
          }
        },
        filterText: {
          value: '',
          observer: 'refreshFilter'          
        },
        filterText2: {
          value: '',
          observer: 'refreshFilter'          
        }
      },
      filterRoom: function(item) {
        return (this.filterText && item.name.match(new RegExp(this.filterText, 'i'))) || 
          (this.filterText2 && item.name.match(new RegExp(this.filterText2, 'i')));
      },
      refreshFilter: function() {
        this.$.resultList.render();
      }
    });
  });
</script>
<x-test></x-test>
  
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers