A parent component obtains subassembly referenced by local variables, and data acquisition method of the active subassembly
1, the use of sub-assemblies to be named # #footer
<app-footer #footer></app-footer>
2, the method of performing direct access to the parent component subassembly of footer
<button (click)='footer.footerRun()'>获取子组件的数据</button>
Second, the method of access to data and active subassembly through ViewChild
1, the use of sub-assemblies to be named # #
<app-footer #footerChild></app-footer>
2, the introduction ViewChild
import { Component, OnInit ,ViewChild} from '@angular/core';
3, ViewChild and just subcomponents associate
@ViewChild('footerChild') footer;
4, sub-assemblies footer calling method
run(){
this.footer.footerRun();
}