1.0.0 • Published 6 years ago

ngx-injection v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

Component Injection CI status

Ngx component injection module.

Installation

npm install ngx-injection

app.module.ts

import { InjectionModule } from 'ngx-injection'; 

... 
imports: [
    ...
    InjectionModule
    ...
] 
... 

Usage

import { InjectionService } from 'ngx-injection';

...
constructor(private _injectionService: InjectionService) { }
...

...
const ref = this._injectionService.injectComponent(TestComponent, {
	inputs: {
	    myInput: 'Hello From Test'
	}, 
    outputs: {
	    myOutput: (e) => { console.log('Hello From Test') }
	}
}, this.template.nativeElement);
...

Configuration

/**
* Component injection options interface.
*/
interface InjectionOptions {
    /**
    * Componenet inputs.
    */
    inputs?: any;
    
    /**
    * Component Outputs
    */
    outputs?: any;
}

Notice

**The component which will be injected must be located in entryComponents.

License

MIT