As I work on enhancing the List page, my main focus is on implementing a search feature.
While the code below effectively displays data in a list format, I am uncertain about how to start incorporating a search functionality into this page.
HTML:
<body ng-app="myApp">
<div ng-controller="empCtrl" class="container">
<div>
<input type="text" ng-model="search_filter" placeholder="Search" />
</div>
<div class="container" infinite-scroll="pagedata()">
<div>
<div>
Id
</div>
<div>
Name
</div>
<div>
Description
</div>
</div>
<div ng-repeat="emp in emps | filter: search_filter"> //<<<<
<div class="column fifth">
{{emp.Id}}
</div>
<div class="column fifth">
{{emp.Name}}
</div>
<div class="column fifth">
{{emp.Description}}
</div>
</div>
</div>
</div>
</body>
MVC Controller:
public ActionResult Employee()
{
var model = new EmployeeViewModel();
var employees = GetEmployees();
model.EmployeeList = employees;
return View("List", model);
}
Angular:
myApp.controller('empCtrl', function ($scope, $http, $window) {
$scope.employees = $window.EmployeeViewModel;
$scope.pagedata = function () {
$http.get($scope.getBaseUrl()).success(function (data) {
});
}
});