myInput을 주의해서 보시면 되겠습니다.
import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-test-trv', template: ` <h2> Welcome {{ name }} </h2> <input #myInput type="text"> <button (click)="logMessage(myInput)">Log</button> `, styleUrls: ['./test-trv.component.css'] }) export class TestTrvComponent implements OnInit { name = "Codevolution"; constructor() { } ngOnInit() { } logMessage(value){ console.log(value); } }