I have a dilemma with my 2 components:
The parent component looks like this:
@Component({
selector: 'parent',
template: `
<child [obj]="obj"> </child>
`,
styleUrls: [''],
})
export class ParentComponent implements OnInit {
obj = {
id: 1,
name: 'abc'
}
}
And the child component is as follows:
@Component({
selector: 'child',
templateUrl: '',
styleUrls: [''],
})
export class ChildComponent implements OnInit {
@Input() obj : any;
}
My issue arises when I try to update the obj property in the parent component but it doesn't reflect in the child component.
I suspect the problem lies in the reference not being changed.
Can you please provide a solution for this?