Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • I was hoping to avoid a shared service. I figured the inheritance would suffice. I can see that when Child updates roleLinks it is in fact updating in Parent's roleLinks They are one in the same. And on Parent component initialization, it is sending roleLinks to SubView. The problem is that Parent is sending roleLinks to SubView (which is undefined on initialization) before Child sends it up to Parent Commented Oct 16, 2019 at 17:45
  • No, they aren't the same. The only way they would be the same is if they were static. Are you using the debugger correctly? Also, even if you had wired it up to the same property, this is not the correct way to implement a two-way data binding. Commented Oct 16, 2019 at 17:47
  • I console.log(this.roleLinks) from both Parent and Child. At the end of Child init, I call Parent init again (with console.log) and it does show the values that I assigend in Child. So calling console.log(this.roleLinks) from Parent is showing the values I assigned from Child Commented Oct 16, 2019 at 17:53
  • See update for StackBlitz link. Open the console, click on Base button. See that roleLinks is undefined. Then click Child1. See that roleLinks is now populated with the same roleLinks assigned from Child1. Then click Child2. Same thing. Base roleLinks is getting populated from the roleLinks in Children that extend Parent. Commented Oct 16, 2019 at 18:36