I'm working on some app where there is an object that has some properties and when I make a http request new properties are added to that object.
this.user = {
id: 1,
name: 'John'
}
this.http.get('https://api.chucknorris.io/jokes/random')
.subscribe(joke => this.user.joke = joke);
The problem is that change detection isn't performed when making the request (this article states that it should be performed as long as I'm not modifying the change detection strategy).
Thus, ngOnChanges
isn't called in the child component where I passed the user object and where I'm doing some complicated stuff when the value arrives from the server.
I attached a simplified stackblitz demo.
Note: I know that I can pass a copy of that object when the new data arrives, but I think it should be a better approach.