iterate array in angular 8 code example
Example 1: typescript foreach
let num = [7, 8, 9];
num.forEach(function (value) {
console.log(value);
});
Example 2: angular for loop
let array = [1,2,3];
for (let i = 0; i < array.length; i++) {
console.log(array[i]);
}
Example 3: angular loop through array
$scope.content = {};
$scope.content.codehttp = [200, 200, 200, 201];
angular.forEach($scope.content.codehttp, function(value, key) {
if (value != 200) {
$scope.flag_a = 'bad';
}
})//this is awsome