import { Component, ViewChild } from '@angular/core';
import { ChildComponent } from './child.component';
//Parent Component
@Component({
    selector: 'app-root',
    //app-child selector is the child component selector
    template: `
    <app-child>Child Component</app-child>
<div>
	  <button style="width:300px; height:100px;" (click)="showChild()">Access Child Component</button>
</div>`
})
export class AppComponent {
    @ViewChild(ChildComponent) child: ChildComponent;//ChildComponent is the child component class name

    showChild() {
        this.child.show();
    }
}
