I'm trying to replace an object with another object, using the angular.forEach function:
angular.forEach(agenda,function(evt){
if(evt.identifiant == event.identifiant){
evt = event;
}
});
For some reason the object evt doesn't get replaced by the event object inside my agenda array. Both evt and event are correct JSON objects (calendars events).
I wonder if my syntax is correct, or if I should do this another way?
EDIT:
This code is working, but it is not what I want, as it is changing only a value inside my evt object:
angular.forEach(agenda,function(evt){
if(evt.identifiant == event.identifiant){
evt.start = event.start;
}
});