Reputation: 93
I would like to delete a $scope variable in my controller, how can I do this?
$scope.myVar = ";
This doesn't remove the variable. I want to completely remove it from the $scope. What is the best way to do this performance wise?
Upvotes: 2
Views: 2246
Reputation: 165059
delete $scope.myVar;
See the delete
operator ~ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete
Upvotes: 4