01. Dynamic Component Loading
The Problem
A business screen should be able to load a child screen when the user opens it, without putting every screen into the initial UI.
The Angular Difficulty
Angular supports runtime component creation through `ViewContainerRef` and component APIs. This is explicit and powerful, but dynamic insertion requires Angular-specific view/container machinery.
Angular Approach
import { ViewChild, ViewContainerRef } from "@angular/core";
@ViewChild("host", { read: ViewContainerRef })
host!: ViewContainerRef;
openDailySale() {
this.host.clear();
this.host.createComponent(DailySaleComponent);
}
MS Approach
ManySet provides a direct runtime-oriented approach for this recurring business-application task.
const ref = await ms.inject(
"./Sales/DailySale",
"content"
);
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.