`$.each()` alternative in Angular JS
21,237
You can use angular.forEach() for iterating in angularjs
angular.forEach($scope.tasks, function (task, index) {
if (task.isCompleted) {
task.showTask = true;
}
});
Comments
-
Kamran Ahmed about 4 years
What is the alternative for jquery's
$.each()
loop in Angular JS.I have got the following in jquery (in my Angular JS based project):
$($scope.tasks).each(function(index, task){ if (task.isCompleted) { task.showTask = true; } });
and I don't want to use the mix of jquery and angular, because they say it is a bad practice to do so (is it?). Is there any feature that angular provides like
$.each()
? Or should I go with the plain javascript?