flag is always false. how can I do?
code here:
var list = ['NOVALUE','VALUE','NOVALUE'];
var flag = false;
angular.forEach(list, function(value){
if('VALUE' === value){
flag = true;
}
});
console.log(flag);
sorry, i missed something
falseagain'VALUE' === 'NOVALUE'breakout of that loop when you found a match. Unfortunately there's no breaking mechanism inangular.forEach: stackoverflow.com/questions/13843972/angular-js-break-foreach