For the existing object add a newly created object without modifying the other objects, here its loosig other properties

branchAccess.pendingList[i] object loosing other properties like it had.

branchAccess.pendingList[i].testMyAccessStatus its undefined after assigning newly added. can we use angular.copy or angular.clone to keep the object with its existing properties and also add a newly created object accessStatusDetails?

This is my code:

this.selectAll = function(branchAccess) {

        //checking if undefined
            var accessStatusDetailsAdd = {
                     accessStatusDetails : { accessStatus : "A" }
                }

            if(branchAccess.pendingList[i].accessStatusDetails == undefined){
                branchAccess.pendingList[i] = accessStatusDetailsAdd;
            }

        }   

Source: AngularJS