0

I have created a html table with static data and now I want to add filter option to the table data using angularjs.

I tried this:

<input type="search" placeholder="Filter" ng-model="searchtext"/> <br/><br/>

<table class="table table-hover">
   <thead>
     <th>Name</th>
     <th>Version</th>
     <th>Type</th>
   </thead>
   <tbody id="Table" class="tbody">
     <tr ng-repeat="filter:searchtext | orderBy: 'name'">
       <td>link</td>
       <td>4</td>
       <td>L1 Type</td>
     </tr>
   </tbody>
</table> 
Drew Gaynor
  • 8,292
  • 5
  • 40
  • 53
mvm
  • 11
  • 1
  • 8
  • you are missing the array info for your `ng-repeat`. Should start with something like `item in items | filter....` – charlietfl Sep 18 '15 at 13:10
  • have you tried answer from @malkus on following thread http://stackoverflow.com/questions/16736901/angular-js-filter-table-with-a-select-box ? – Ravish Sep 18 '15 at 13:10
  • I dont want to use the values from angular controller instead i take values from table – mvm Sep 18 '15 at 13:12
  • take a look at the docs: https://docs.angularjs.org/api/ng/filter/orderBy it tells you exactly how to orderBy, as @charlietfi says you are missing the array@ – Jax Sep 18 '15 at 13:13
  • 2
    you can't use `ng-repeat` on raw html table....concept is flawed. Please explain table source and expectations in more detail. Worst case you could parse the html to data array but that seems very backwards – charlietfl Sep 18 '15 at 13:14

0 Answers0