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

17.0.0 • Public • Published

npm version NPM Bundle Size Download

Inyector

Angular service for component injection

Installation

npm install inyector --save

Demo

You can see the demo in https://inyector.netlify.com/

Usage

Import

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 { }

Inject component in body

this.inyector.add(TestComponent);

Inject component in an element

this.inyector.add(TestComponent, {
    parent: htmlElement
});

Floating injection

Inject component in a floating docker and attach it to another element

this.inyector.dock(TestComponent, parentHtmlElement, {
    position: 'top'
});

Package Sidebar

Install

npm i inyector

Weekly Downloads

7

Version

17.0.0

License

ISC

Unpacked Size

90.5 kB

Total Files

25

Last publish

Collaborators

  • alan3d