Home How to alter an array in JS file through a method call from HTML in Angular?
 I'm using Angular.js and trying to clear an array which is first instantiated and held on my module:  angular.module(myApp) .controller('myCtrl', function (\$rootScope){ var vm = this; vm.myArr = ["Clear", "Me"] vm.clearer = function(arr) { arr = []; }; vm.copier = function(arrToOverwrite, arrToCopy) { arrToOverWrite = angular.copy(arrToCopy); };  And I call this method from my HTML file:  (controller myCtrl is aliased as ctrl)  However, in the JS, it is underlining the arr, saying the value is never used. And, say I have something that always displays the value of myArr in the HTML, it is unaffected by the changes. I thought since JS is pass by reference, if myArr is passed as the reference in the clearer method, if it gets updated there, that it would then be updated with that value everywhere? How would I go about this? I need to use the clearer method in other places on other arrays that may be held "in memory" here in the JS file at other times.