Nishant Roy Nishant Roy - 3 years ago 84
AngularJS Question

ng-repeat hide rows with empty object

I have a table where I am repeating over an array of objects. Within the object, there is a nested object, like so:

{"Sub_obj" : {}

{"Sub_obj" :
{"Name" : "Jane"}

I want to
the table row where
is empty. How can I achieve this? I tried
, but that doesn't work.

Answer Source

Make a simple function that checks the length of the keys in object:

  return !angular.isObject(obj) || !Object.keys(obj).length


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download