03. Calling Component Methods
The Problem
A business screen may need to tell a child component to refresh, save, print, or perform another operation.
The Angular Difficulty
Angular can call a child through `@ViewChild`, but this introduces a view-query relationship and lifecycle timing considerations.
Angular Approach
@ViewChild(CustomerEditorComponent) editor!: CustomerEditorComponent;
refreshCustomer() {
this.editor.refresh();
}
// Child
refresh() { /* ... */ }
save() { /* ... */ }
MS Approach
ManySet provides a direct runtime-oriented approach for this recurring business-application task.
const editor = await ms.inject("./Customers/Editor", "content");
await editor.refresh();
await editor.save();
Why this way is useful in business applications :
The comparison is intended to show where ManySet supplies a business-application abstraction around a recurring task, while keeping HTML and JavaScript visible and directly usable.
Key Point :
ManySet reduces the amount of framework-specific composition required for this particular task, without requiring the React/Angular mechanism to be represented as inherently wrong or incapable.