There is a single object defined as
requestObject: any = {
"type": 'type1',
"start": 0,
"size": 10,
"keywords": ['abcd','efgh'],
filters: [],
}
Next, attempting to change the value for keyword, I updated it like so:
requestObject['keywords'] = ['pqr']
Despite this change, the console log still displays the initial value.
"keywords": ['abcd','efgh'],
I then attempted to delete the key and add the modified value with the same key name, yet the result remained unchanged.
delete requestObject.keywords
requestObject['keywords'] = ['pqr'];
Explanation in Detail:
There are two sibling components, referred to as A and B (NgbModal). Within component A, there exists a request object. When a button within component A is clicked, component B (NgbModal) appears allowing for value updates which can then be submitted. Upon submission, the values are sent back to Component A using an event emitter and captured using:
modalRef.componentInstance.filterApplied.subscribe((res: any) => {}
Ultimately, when attempting to update the object in Component A, the changes do not reflect and the old values persist.