Searcher in table javascript does not find with AngularJS

1

I have a table in my template that has a search engine, when I put the td manually let's say it works without problems but using Angular to show the data in the table does not find results.

     <div ng-controller="usersController">
          <table class="datatable table table-striped primary" cellspacing="0" width="100%">
    <thead>
        <tr>
            <th>Nombre</th>
            <th>Email</th>
            <th>Nivel</th>
        </tr>
    </thead>
    <tbody>
        <tr ng-repeat="data in names">
          <td ng-bind="data.nombre"></td>
          <td ng-bind="data.email"></td>
          <td ng-bind="data.nivel"></td>
        </tr>
    </tbody>
</table>
</div>
    
asked by Santiago D'Antuoni 03.01.2017 в 21:18
source

1 answer

1

In angular you must use filter to search. I leave the official documentation, and below an example to test it with your code so it is sure that it works.

link

Example:

 
<input type="text" ng-model="query" placeHolder="introduce un valor">
<div ng-repeat="data in names" | filter: query>

Greetings

    
answered by 03.01.2017 / 21:28
source