Created
March 9, 2019 03:18
-
-
Save t-palmer/36309e5233ea11cd445c38fce92e4876 to your computer and use it in GitHub Desktop.
Example parent component for viewchild-unit-test-example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, ViewChild } from '@angular/core'; | |
import { ChildComponent } from '../child/child.component'; | |
@Component({ | |
selector: 'app-parent', | |
template: ` | |
<button type="button" (click)="update()">Update</button> | |
<br> | |
<app-child></app-child>` | |
}) | |
export class ParentComponent { | |
@ViewChild(ChildComponent) childComponent: ChildComponent; | |
update() { | |
this.childComponent.updateTimeStamp(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment