Reputation: 42
I am planning to add dynamic components at certain location in my Angular 2 app. I tried adding anchor points but it didn't work.
Upvotes: 2
Views: 671
Reputation: 86
Use an anchor Point in html
In ts file
constructor(private componentFactoryResolver: ComponentFactoryResolver,
private viewContainerRef: ViewContainerRef) {}
Create a component factory Get the reference of the anchor point Bind any data if required Run detect changes for updating it
Upvotes: 3