Answer the question
In order to leave comments, you need to log in
How to use as filter for ng-repeat in AngularJs?
Is there <input type="date">
a sign with ng-repeat under it? By default, ng-repeat displays elements with today's date. And it is necessary that after changing the date in the input, the content in ng-reapeat changes (with the date from the input).
update :
Tried to do it this way:
in html
<input type="date" ng-model="bd" />
<button ng-click='changeDate()'>Ok</button>
$scope.changeDate = function() {
var changedDate = $scope.bd;
$http.get("/api/meals/" + changedDate)
.success(function(data) {
self.updateMeals(data);
console.log($scope.bd);
})
.error(function(){
console.log('Error get Meals')
});
};
Answer the question
In order to leave comments, you need to log in
don't use filters with ngRepeat. That's all science.
To change today's date (for example, using ngChange or other callbacks of your datepicker directive), we simply call the controller method that will form a new collection. And that's all.
ps no $scope.$watch ! and generally don't use $scope anywhere except in a link directive, which you should also rarely ever need. Y031
ng-repeat operates on a set of data. Describe a method in the controller that filters the main set depending on the value in the input. You can use $scope.$watch for this .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question