更新时间:2023-11-29 10:57:34
您可以使用: Object.keys(card)。length === 0
但请确保从控制器的方法中使用它作为对象
在视图中不可用,例如:
But make sure you use it from a method of the controller as the Object
is not available in the view, like:
$scope.isObjectEmpty = function(card){
return Object.keys(card).length === 0;
}
然后你可以从视图中调用该函数:
Then you can call the function from the view:
ng-show="!isObjectEmpty(card)"