ionic3懒加载中使用自定义组件component

问题:

由于使用了懒加载所以不能像之前一样直接引用component对象,在网上找了好多办法找了好多尝试终于知道怎么调用component了,记录一下使用自定义组件的详细过程

解决:

1. ionic g component mycomponent ,新建名为mycomponent的自定义组件

2.在app.module.ts中删除mycomponent的引用

3.在想使用此组件的懒加载控件中导入mycomponentmodule

import{MyComponentModule}from'../../../components/disposeprogress/disposeprogress.module';

@NgModule({

declarations:[IncidentDetails],

imports:[IonicPageModule.forChild(IncidentDetails),MyComponentModule]

})

4.在html文件中引用mycomponent即可显示mycomponent对应的h5界面












exportclassIncidentDetailsModule{ }

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容