angular 父组件调用子组件方法---以及组件跨模块使用方法

如果要在父组件调用子组件

可以这样子

 

@ViewChild('mySun', { static: false }) mySun: MySunComponent;

使用方法:
let res=this.mySun.getDatas();

组件跨模块使用方法

@NgModule({
imports: [
AModule,
BRoutingModule
],
declarations: [
...COMPONENTS,
...COMPONENTS_NOROUNT
],
exports:[
SunComponent,
SunnComponent
],
entryComponents: COMPONENTS_NOROUNT
})

 

posted @ 2021-03-10 23:57  糖~豆豆  阅读(416)  评论(0编辑  收藏  举报
Live2D