AngularJs check empty array- It is very simple to check if an array is empty in AngularJs. You can just use the array.length property. Here in this tutorial we are going to explain how you can check if an array is empty. You can use our online demo try and edit the code online.
AngularJs check empty array | Example
array.length property is used to find the array length ie. size of array. It will give 0 if array is having no element.
AngularJs check empty array | Example:
<div ng-app="myApp"> <div ng-controller="myController"> <button ng-click="checkArray()">Check Array</button> </div> </div> |
If you run the above example it will produce the output something like this –