javascript - ng-repeat hide rows with empty object -
i have table repeating on array of objects. within object, there nested object, so:
[ {"object1": {"sub_obj" : {} } }, {"object2": {"sub_obj" : {"name" : "jane"} } } ]
i want ng-hide
table row "sub_obj"
empty. how can achieve this? tried ng-hide=!sub_obj
, doesn't work.
make simple function checks length of keys in object:
$scope.isemptyobject(obj){ return !angular.isobject(obj) || !object.keys(obj).length }
view
ng-hide="isemptyobject(item.sub_obj)"
Comments
Post a Comment