What are some suitable names for an event emitter meant to trigger a parent component to refresh it's data object

by Jason Spradlin   Last Updated October 27, 2017 18:05 PM

Our data is structured to have a parent resource with multiple child resources. In the child component, which is mapped to one of those child resources, when a form is submitted (PUT), that child resource is refreshed afterward.

In one specific case, when that PUT request is successful, it triggers changes to the parent resource on the server, and requires the parent component to refresh its resource.

Currently, I've created an event emitter/output on the child component named update. And when the conditions are met that require the parent to refresh, we run this.update.emit().

The parent, meanwhile, plugs into the child component's output via the HTML in the parent component template:

<child-component [resource]="childResource" (update)="refreshParentResource()" />

My concern is that the event being emitted is not an update, per se. It's more of a request for the parent to refresh, but I don't feel any better about an event emitter like this.requestFullRefresh.emit() in the child component. Perhaps an event emitter is not the way to go? But how do I otherwise communicate the need for a refresh FROM the child component TO the parent component?

Tags : naming angular2

Related Questions

Naming a view class

Updated June 14, 2017 19:05 PM