How to clear an angularJS array
Solution 1:
$scope.itemarray.length = 0;
<< this is correct. Length is read-write property.
$scope.itemarray = [];
<< this creates new empty array. If you have bindings to old itemarray, they may be lost. (Html binding like ng-if="itemarray[0]"
wont be lost)