my pages uses lots of ng-repeat to generate table rows. If there is no data in an json array, there would be an empty table. I'm trying to skip generating table rather than an generate an empty one.
To do that, I need to check if the array length is 0. In js I can get array length using its length property:
$scope.data.errors.length === 0
But I can't use it in angular watcher, the following has no output
{{data.errors.length}}
And data.errors.length === 0
gives false.
So is there a way to get json array length in angular?
ng-if="data.errors"
in the tables parent – Dylan Oct 28 '14 at 2:20$scope.data.length
? – JLewkovich Oct 28 '14 at 2:28data
ordata.error
– entre Oct 28 '14 at 3:40