79367229

Date: 2025-01-18 13:38:37
Score: 0.5
Natty:
Report link

For anyone still facing this issue, here is my solution (based on @ceifard solution):

In the parent component TS:

someObj = new TestObj();

protected getObjCopy(obj){
 return Object.create(obj);
}

In the parent component template:

<app-stuff [inputObj]="getObjCopy(someObj)"></app-stuff>

In AppStuffComponent TS:

ngOnChanges(changes: SimpleChanges){
 console.log("Changes to inputObj detected !");
}

What is nice here is that we are able to use the properties and methods of someObj in AppStuffComponent. A possible drawback is the performances, I did not check precisely.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @ceifard
  • Low reputation (0.5):
Posted by: Maxwell09