Home

Published

- 1 min read

dynamic component angular parameters

img of dynamic component angular parameters

The solution for this is noted below

dynamic component angular parameters

Solution

   const factory = this.componentFactoryResolver.resolveComponentFactory(LoginComponent);
    const component: ComponentRef<LoginComponent> = this.viewContainerRef.createComponent(factory);
    component.instance.user = "prop 1";
    component.instance.input2 = "prop 2";

Try other methods by searching on the site. That is if this doesn’t work