I am having the textfeilds where i will enter the date rage , so based on the date range the data will be fetched from the database . Now I am having the ng-repeat in view to show the data , So i need to change the data based on the values selected in the date rage . I have tried applying filters but it is not working because it has to hit the database when the values changed. can anyone suggest me solution?
<input ng-model="From_Date" ng-change="setCustomSelect()" type="text" class="form-control" placeholder="Select from Date" datepicker readonly></input>
<input ng-model="To_Date" ng-change="setCustomSelect()" type="text" class="form-control "placeholder="Select to Date" datepicker readonly></input>
<tr ng-repeat="user in users">
<td >
{{user.name}}
</td>
<td >
{{user.email}}
</td>
</tr>
As you stated your getting your data from a database, you should aim to pass the dates to your backend service, query your users by date and then return them.
You can use the
ngChangedirective on your inputs to call a function defined in your controller, which will in turn get data from your service and update your view with that data.In your service you can make your request via Angular's
$httpservice, passing the dates as params.This is the sort of structure you can use: