I'm working with a small datagrid in Angular 2 and i have a question about parent/child relationships between components. I have two components: app-datagrid and app-add-item. The datagrid component, in his HTML, includes the app-add-item component, which is composed of a button and a modal. When clicked, the button displays the modal with a form to create a new item.
All the logic is isolated and nice: the app-add-item component creates and handles the form, sends the form data to the service and creates a new item. However, how can i update the datagrid once its child component has finished adding a new item?
Should the app-datagrid component listen for an event? Should it be passed as a dependency to the child? What's the proper way of doing this?