Angular 19 Tutorial in Hindi #13 Get and Set Input field Value

Ways to Set and Get Value in Input field

Make input field pass and function

Get Value with event

Get Value with template reference variable

Interview Question

<h1>Event in Angular</h1>
<button class="btn" name="login" (click)="handleEvent($event)" >Click on Button</button>

<br><br>
<div
(mouseenter)="handleEvent($event)"
style="background-color: green; height: 100px; width: 100px;">

</div>

<br><br>
<div
(mouseleave)="handleEvent($event)"
style="background-color: red; height: 100px; width: 100px;">

</div>

<br><br>
<input
(blur)="handleEvent($event)"
(focus)="handleEvent($event)"
(input)="handleEvent($event)"
type="text" name="user" >


import { Component, signal } from '@angular/core';
@Component({
selector: 'app-root',
imports: [],
templateUrl: './app.component.html',
styleUrl: './app.component.css'
})
export class AppComponent {
handleEvent(event:Event){
console.log("function called",event.type);

}
}