// Our main module & controller for displaying the filter issue // while using the ng-repeat var app = angular.module('myModule', []); app.controller('myController', function () { // Set the name string array here this.names = ['John', 'Mary', 'Mike', 'Adam', 'Julie', 'Juliette']; });
<div ng-controller="myController as ctrl" style="padding:0 15px"> <div class="container-fluid"> <div class="page-header"> <h1>AngularJS Trick <small>#1</small></h1> </div> <div class="row well"> <label>Search:<input ng-model="searchText" /></label> <hr/> <table id="searchTextResults"> <tbody> <tr> <th>Name</th> </tr> <tr ng-repeat="name in ctrl.names | filter:searchText"> <td>{{name}}</td> </tr> </tbody> </table> <hr/>Showing <b>{{ctrl.names.length}}</b> results...</div> </div> </div>