@ngxhub/ngx-dynamic
v0.1.40
Published
Inject components according to configuration and dynamically create components
Downloads
10
Readme
@ngxhub/ngx-dynamic
Description
Inject components according to configuration and dynamically create components
English | 简体中文
Software Architecture
Tool library created based on Angular16
Installation
$ npm install @ngxhub/ngx-dynamic
Instructions
Create Component
$ ng g c components/is-button $ ng g m components/is-button
Modify Component module[is-button.module.ts]
export class IsButtonModule { static entry = IsButtonComponent; }
Injection Component[AppModule]
import { NgModule } from "@angular/core"; import { DynamicModule, IS_BIZ_COMPONENT } from "@ngxhub/ngx-dynamic"; const widgets = { "is-button": import("./components/is-button/is-button.module").then((r) => r.IsButtonModule), }; @NgModule({ imports: [DynamicModule], providers: [{ provide: IS_BIZ_COMPONENT, useValue: widgets }], }) export class AppModule {}
Using Component
<div x-dynamic [item]="{type:'is-button'}" (eventManage)="onEventManage($event)"></div>