I am working with a JSON array containing objects, each with various key-value pairs. I am using ng-repeat to display these objects on my HTML page. When I click edit for a specific object, a modal from Bootstrap toggles. Any changes made in the modal window should directly affect the JSON object and update the UI instantly. To achieve this, I am using angular.copy to duplicate the object and display it in the modal window. My goal is to replace the original object in the JSON array with the duplicated one by clicking an update button within the modal dialog. How can I accomplish this? Here is a sample of my code:
$scope.array = [{"ItemId":"20113",
"ItemModel":"C2",
"ItemName":"Nokia", .....},
{....},
{....},
{....}, ......]
I need to splice index 2 in the array and insert a new object at the same index.