如果要在父组件调用子组件
可以这样子
@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
})