ngx-injection
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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

Package Sidebar

Install

npm i ngx-injection

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

161 kB

Total Files

27

Last publish

Collaborators

  • oktaykirik