I have this code in angular
var divCounter = 1;
$scope.data = [];
$scope.data = data;
angular.forEach($scope.data, function(value, key) {
if (value.hasCar === 0 && value.id != 45){
var divtxt = "divtxt" + divCounter;
$scope.divtxt = value.description;
divCounter++; }
});
HTML is
<div > {{ divtxt1 }} </div>
<div > {{ divtxt2 }} </div>
$scope.data
is an array that contains JSON ,that came from ajax.
Loop through that table and grab only the objects that have no car and not an id of 45. So right now I have 2 objects out of 10. I know I will only get 2 objects and always put them in 2 divs.
Now , grab those objects and put them in the scope, that its name is created dynamically, divtxt1 or divtxt2.
This does not work, I get no errors in the console, but I also see nothing in my HTML.
What am I missing?
Thanks.