I am pretty new in js and angularjs and ran into some basic problem i can't solve. I add the $scope.consignations to the view with ng-repeat. Its a big object with several layers. In the sample code, i assign the $scope.consignations to the temp and after that, i "navigate" inside the temp object and at some point i push data to the temp. It changes the view, as expected.Now i want to clear the $scope[elementName] obj, but it clears the pushed data as well from the view. I've tried to delete the temp reference (i assume its only a reference of the $scope.consignations obj.) and i cant access it anymore, but when i clear the $scope[elementName] it clears the view anyway.
$scope.addElements = function(elementName){
temp=$scope.consignations;
for (var key in someArray) {
//here i "navigate" recursive inside temp
}
temp.push($scope[elementName]);
delete temp;
for (var key in $scope[elementName]) {
$scope[elementName][key]="";
}
};
delete tempis doing? The delete operator is only used to delete properties, not objects.