Total Pageviews

2013/11/26

How to clear an array in AngularJS?

Question
If we have an array in AngularJS, how do I clear its content?

Answer
If we have an array, ex.
 $scope.itemarray = ['A', 'B', 'C'];  

If we would like to clear its content in specific situation, what we need to do is as bellowing:
 $scope.itemarray.length = 0;  

No comments: