Php Angularjs foreach循环不返回false

Php Angularjs foreach循环不返回false,php,angularjs,Php,Angularjs,我正在使用angularjs foreach循环 $scope.Qsets=infoData; try { angular.forEach($scope.Qsets,function(value,index){ if( typeof value === 'undefined' ) { return false; }; });

我正在使用angularjs foreach循环

$scope.Qsets=infoData;
          try {
           angular.forEach($scope.Qsets,function(value,index){
               if( typeof value === 'undefined' ) {
                   return false;
                };
            });
        }
        catch(e) {
            alert(e);
        }
//if not false other code here

当my
if(typeof value===“undefined”)
变为true时,它应该通过返回false来中断循环。但它并没有打破循环,而是继续使用下面的代码。如果我的
if(typeof value=='undefined')
变为true,如何防止执行其他代码?

在Angular的forEach内部返回false不会中断循环。用于循环或类似的东西

var keepGoing = true;
angular.forEach([0,1,2], function(count){
  if(keepGoing) {
    if(count == 1){
      keepGoing = false;
    }
  }
});

控制台中有错误吗?请尝试使用变量并按住
true/false
,然后在
foreach
之外返回如下内容:
return isTrue
@Manikandan其输入'if'语句块但不要中断循环参见下面的我的答案。@Manikandan不工作