简体   繁体   English

使用父类动态加载组件

[英]Dynamic component loading using Parent Class

I am trying to create a generic code for dynamic component loading. 我正在尝试为动态组件加载创建通用代码。 I have implemented parent child relationship. 我已经实现了亲子关系。 In it, child is overriding parent and will be used to dynamically load components.Below is the link I followed - 在它中,child是重载parent,将用于动态加载组件。下面是我关注的链接-

dynamic component loading 动态组件加载

I made changes in it and now it looks something like below link - 我对其进行了更改,现在看起来类似于下面的链接-

Updated with my changes 更新了我的更改

Somehow it is not working and doesn't load changes. 不知何故,它不起作用并且不会加载更改。 What am i missing here. 我在这里想念什么。

I fixed the above issue by adding below lines in my module.ts - 我通过在module.ts中添加以下行来解决上述问题-

 entryComponents: [
    Child1, Child2
]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM