import { Component } from '@angular/core';
@Component({
selector: 'app-root', // 이 컴포넌트를 쓰기위한 명칭 app-root -> index.html 에서 사용
templateUrl: './app.component.html', // 화면 구성
styleUrls: ['./app.component.css'], // 스타일 지정
})
export class AppComponent {
title = '이벤트 바인딩 실습';
handleEvent(): void {
console.log('handleEvent');
}
handleEvent2(name: string): void {
console.log('handleEvent2===', name);
}
}
<h1>
{{ title }}
</h1>
<button (click)="handleEvent()">클릭 1</button>
<button (click)="handleEvent2('박성원')">클릭 2</button>