Angular service for component injection
npm install inyector --save
You can see the demo in https://inyector.netlify.com/
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { InyectorModule } from 'inyector';
@NgModule({
imports: [
BrowserModule,
InyectorModule.forRoot()
],
bootstrap: [AppComponent]
})
export class AppModule { }
this.inyector.add(TestComponent);
this.inyector.add(TestComponent, {
parent: htmlElement
});
Inject component in a floating docker and attach it to another element
this.inyector.dock(TestComponent, parentHtmlElement, {
position: 'top'
});