0.1.1 • Published 5 years ago
@hangar42/ngx-injector v0.1.1
ngxInjector
ngxInjector is a simple and lightweight Angular module build to dynamically injecting components into the DOM.
Installation
Install via NPM:
npm install @hangar42/ngx-injector
or manually download it.
Usage
1. Include InjectorModule as a dependency in your desired module:
import {InjectorModule} from 'ngx-injector';
...
imports: [
InjectorModule,
...
]
2. Use The InjectorService
import {InjectorService} from 'ngx-injector';
import {SomeComponent} from '../some.component';
...
constructor(private injectorService: InjectorService){}
public someFunction(){
const params = {
... properties you want to inject in the component
}
this.injectorService.injectComponent(SomeComponent, params);
}
Development
- Clone the repo or download it
- Install dependencies:
npm install
- Run
ng build --project ngx-injector
- Run
ng serve
License
GPLv3 Link