cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <main ng-app="myApp">
  <p>Two way data binding can be used to display what the user types in real time:</p>
  <div>
    <label>Input:</label>
    <input type="text" id="input" />
  </div>
  <div>
    <label>Output:<label>
    <span id="output"></span>
  </div>
      
  <hr>
      
  <p>Use two way data binding to filter a list on the fly:</p>
      
  <table border="1" cellspacing="0" cellpadding="0" ng-controller="myCtrl">
    <tr>
      <td>Filter:</td>
      <td><input type="text" id="filtering"></td>
    </tr>
    
    <tr>
      <th>Name</th>
      <th>Email Address</th>
    </tr>
    
    <tbody id="people">
      
    </tbody>
  </table>
</main>
            
          
!
            
              * {
  box-sizing: border-box;
}

div {
  margin: 10px;
  padding: 5px;
  width: 320px;
}

table {
  width: 50%;
}

td {
  padding: 5px;
}

td input {
  width: 100%;
  padding: 10px;
}

            
          
!
            
              (function () {
  // Function required for data binding
  $('#input').keyup(function (event) {
    $('#output').html($('#input').val());
  });
  
  var people = [
      { name: "John Smith", email: "smithj@example.com" },
      { name: "Jane Doe", email: "jane.doe@example.com" },
      { name: "Jeff Smith", email: "jsmith@mail.com" },
      { name: "Jake Doe", email: "jake@sf.com" }
    ];
      
  // "ng-repeat" to make the array add to the table
  $.each(people, function(index, value) {
    $('#people').append("<tr><td>" + 
      value.name +
      "</td><td>" +
      value.email + "</td></tr>"
    );
  });
  
  // "filtering"
  $('#filtering').keyup(function (event) {
    var filtering = $(this).val();
    if(filtering == '') {
      $('#people tr').show();
    }
    
    // Filter the people
    $('#people').find('tr').each(function () {
      var values = [];
      $this  = $(this);
      
      // Get the value of the elements
      $this.children('td').each(function () {
        values.push($(this)[0].innerText);
      });
      
      // Show hide if value is in the tds
      $.grep(values, function (n, i) {
        if(n.indexOf(filtering) >= 0) {
          $this.show();
        } else {
          $this.hide();
        }
      }, true);
    })
  });
})();
            
          
!
999px
Loading ..................

Console