I am working on a code where a table data can be searched with a text box entry.
My HTML code goes as follows,
<body ng-app="myModule">
<div ng-controller="myController">
<div><input type="text" ng-model="searchText" placeholder="Enter Search Text" /><br><br></div>
<table>
<thead>
<th>Person</th>
<th>Salary PA</th>
<th>Date Of Joining</th>
<th>Programs Completed</th>
</thead>
<tbody ng-repeat="person in people|filter:searchText">
<td>{{person.name|uppercase}}</td>
<td>{{person.salaryPA|currency}}</td>
<td>{{person.Doj|date:"MM/dd/yyyy"}}</td>
<td>{{person.ProgramsCompleted|number}}</td>
</tbody>
</table>
</div>
</body>
Java Script:
angular.module("myModule", []).controller("myController", functionCall);
function functionCall($scope) {
var people = [{
name: "Hulk",
salaryPA: 25000,
Doj: new Date("March 18, 2014"),
ProgramsCompleted: 250,
}, {
name: "Superman",
salaryPA: 12000,
Doj: new Date("March 18, 2014"),
ProgramsCompleted: 200,
}, {
name: "Batman",
salaryPA: 12500,
Doj: new Date("January 18, 2014"),
ProgramsCompleted: 180,
}];
$scope.people = people;
}
Output:
The third row in the table does not have the character 'r'. But when I search with 'r', filter is not working as it should. Could anyone help me figure this?
Thanks
