viewchild code example
Example 1: angular viewchild input element value
// in html
<input #input type="text">
// in .ts
@ViewChild('input') input:ElementRef;
//Output value
console.log(this.input.nativeElement.value);
Example 2: @viewchild elementref
@ViewChild('ID', {static: true}) NAME: ElementRef | undefined;