@rakutentech/angular-dynamic-component-loader
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Angular Dynamic Component Loader

This library exposes a dynamic loader for angular components.

Table of contents

Prerequisites

Installation

  • Install Angular Dynamic Component Loader:
npm install @rakutentech/angular-dynamic-component-loader

Download

  • NPM
    • npm i @rakutentech/angular-dynamic-component-loader
  • GIT
    • git clone https://github.com/rakutentech/angular-dynamic-component-loader.git

Usage

To use Angular Dynamic Component Loader, you will need to import the DynamicComponentLoaderService:

import { DynamicComponentLoaderService } from '@rakutentech/angular-dynamic-component-loader';

You can now create a dynamic component. This is done by calling the loadComponent() method of the service, which first needs to be injected:

// ...

constructor(
  private readonly dynamicComponentLoaderService: DynamicComponentLoaderService,
  // ...
) {}

// ...
const component = this.dynamicComponentLoaderService.loadComponent(componentType, {}, true, instanceInjector);

It takes four arguments:

  • The class name of the dynamically loaded component.
  • The data of the component instance.
  • Should be set to true if the view should be assigned to a viewContainer
  • The providers injector of the component instance.

Development

Clone the repository and install all the necessary dependencies.

git clone https://github.com/rakutentech/angular-dynamic-component-loader.git
cd angular-dynamic-component-loader
npm install

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @rakutentech/angular-dynamic-component-loader

Weekly Downloads

12

Version

1.0.0

License

none

Unpacked Size

26.4 kB

Total Files

16

Last publish

Collaborators

  • jcayzac
  • boazy