I have the following table based in this example (try to use the 'search' input)
<tr data-ng-repeat="product in filteredArray=(products | filter:findProducts)">
<td>{{$index+1}}</td>
<td>{{product.name}}</td>
<td>{{product.price}}</td>
</tr>
As you can see, the filteredArray array is dynamic because this array will list objects based on the filter result and what I need to do is get this filteredArray array in the controller into a forEach method.
Controller
app.controller("controllerApp", function($scope){
$scope.products = [
{id:1, name: "product AAA", price: 12},
{id:2, name: "product AAB", price: 21},
{id:3, name: "product ABB", price: 32},
{id:4, name: "product ABC", price: 45},
{id:5, name: "product ACC", price: 34},
{id:6, name: "product ACA", price: 63},
{id:7, name: "product ACB", price: 47},
{id:8, name: "product BBA", price: 87},
{id:9, name: "product BBB", price: 59},
{id:10, name: "product BBC", price: 43},
{id:11, name: "product CCA", price: 76},
{id:12, name: "product CCB", price: 44}
];
// I can't get the 'filteredArray' from the view.
angular.forEach(filteredArray, function(value, key){
console.log("object from filtered array: "+value)
})
});
Any idea?