Search code examples
angularjsangularjs-scopeng-showangular-ng-ifng-hide

AngularJS - Hiding value based on null and empty array


I am trying to perform an ng-hide when a value is either null or an empty array (in Firebug, this appears as []).

I can carry out the null via:

ng-hide="myData.Address == null"

However when i try:

ng-hide="myData.Address == null || myData.Address == []"

The value still appears.


Solution

  • Try this:

    ng-hide="myData.Address == null || myData.Address.length == 0"