Depending on your application's separation of concerns, it might make sense for a child component in your application to reference a parent, and at the same time, for the parent to reference the child. There are two similar implementations that allow you to accomplish this: using ViewChild
and ContentChild
. This recipe will discuss them both.
Note
The code, links, and a live example of this are available at http://ngcookbook.herokuapp.com/1315/.
Begin with the recipe setup shown in Referencing a parent component from a child component. Your objective is to add the ability to enable and disable the like button from the parent component.