import { bootstrapApplication } from '@angular/platform-browser';
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
standalone: true,
template: `
<h3>Events</h3>
<p>Count: {{ count }}</p>
<button (click)="increment()">Click me</button>
<div style="margin-top:12px">
<input placeholder="Type..." (input)="onInput($event)" (keyup)="lastKey = $any($event).key">
<p>Value: {{ value }}</p>
<p>Last key: {{ lastKey }}</p>
</div>
`
})
export class App {
count = 0;
value = '';
lastKey = '';
increment() { this.count++; }
onInput(e) { this.value = (e && e.target && e.target.value) || ''; }
}
bootstrapApplication(App);
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Angular Events</title>
</head>
<body>
<app-root></app-root>
</body>
</html>