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> 
5
  • you are missing the array info for your ng-repeat. Should start with something like item in items | filter.... Commented Sep 18, 2015 at 13:10
  • have you tried answer from @malkus on following thread stackoverflow.com/questions/16736901/… ? Commented Sep 18, 2015 at 13:10
  • I dont want to use the values from angular controller instead i take values from table Commented Sep 18, 2015 at 13:12
  • take a look at the docs: docs.angularjs.org/api/ng/filter/orderBy it tells you exactly how to orderBy, as @charlietfi says you are missing the array@ <tr ng-repeat="friend in friends | orderBy:'-age'"> Commented Sep 18, 2015 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 Commented Sep 18, 2015 at 13:14

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.