$scope.itemarray = ['A', 'B', 'C'];
this will clear the array but the ui wont be updated.
$scope.itemarray = [];
this works fine! why?
$scope.itemarray.length = 0;
$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)
ng-submit
happening before your clear event perhaps? Maybe you're adding to the array somehow then trying to clear it. Otherwise= []
should be working fine