Angularjs 如果数组中的对象缺少字段,如何隐藏元素

Angularjs 如果数组中的对象缺少字段,如何隐藏元素,angularjs,Angularjs,我有一个html元素,如下所示: <div ng-hide="!myarr.length"> Im showing </div> myarr[0] = {name: 'jack', type: ''} myarr[1] = {name: 'jack'} myarr[2] = {name: 'jack', type: 'mytype'} 在上述情况下,div应该继续隐藏,因为并非所有json对象都包含一个非空的“type”字段 我如何做到这一点? 我在想在n

我有一个html元素,如下所示:

 <div ng-hide="!myarr.length">
    Im showing
 </div>
myarr[0] = {name: 'jack', type: ''}
myarr[1] = {name: 'jack'}
myarr[2] = {name: 'jack', type: 'mytype'}
在上述情况下,div应该继续隐藏,因为并非所有json对象都包含一个非空的“type”字段

我如何做到这一点?
我在想在ng隐藏中有一个OR语句。也许我可以使用“some”功能。但是当这样做时,我似乎无法在ng隐藏中运行这种函数(至少我的编辑器用红色标记代码)。是否有一种替代方法可以做到这一点,而无需调用控制器中的函数

检索数据时,可以迭代数组中的每个对象并检查各个对象。如果任何单个对象不包含必要的数据,请将显示标志设置为false并中断循环

$scope.showElement = true;
$scope.array = [
    {name: 'jack', type: ''},
    {name: 'jack'}
    {name: 'jack', type: 'mytype'}
];

for(let i=0; i<$scope.array.length; i++){
  if($scope.array[i].type === undefined || $scope.array[i].type === ''){
    $scope.showElement = false;
    break;
  }
}
$scope.showElement=true;
$scope.array=[
{名称:'jack',类型:'},
{姓名:'杰克'}
{name:'jack',type:'mytype'}
];

对于(设i=0;i检索数据时,可以迭代数组中的每个对象并检查各个对象。如果任何单个对象不包含必要的数据,请将显示标志设置为false并中断循环

$scope.showElement = true;
$scope.array = [
    {name: 'jack', type: ''},
    {name: 'jack'}
    {name: 'jack', type: 'mytype'}
];

for(let i=0; i<$scope.array.length; i++){
  if($scope.array[i].type === undefined || $scope.array[i].type === ''){
    $scope.showElement = false;
    break;
  }
}
$scope.showElement=true;
$scope.array=[
{名称:'jack',类型:'},
{姓名:'杰克'}
{name:'jack',type:'mytype'}
];
for(设i=0;i