Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

185
Views
keyup, keydown, blur are not working in angular 12

I am using angular 12 and trying to play with events. The only click event is working, no other events are getting triggered.

allEvents.ts

import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-all-events',
  templateUrl: './all-events.component.html',
  styleUrls: ['./all-events.component.css']
})
export class AllEventsComponent implements OnInit {
  constructor() { }
  ngOnInit(): void {
  }
  myEvent(evt : any) {
    console.error(evt)
  };
 
}

allEvents.html


<button (click)="myEvent('I am click event')" >Click Event</button>
<br><br>
<input type="text" (onkey)="myEvent($event)" />

When I click on the button on console statements are getting executed, but keydown, keyup, or blur is not working.

-----Configurations------

Angular CLI: 12.2.12 Node: 14.17.6 Package Manager: npm 6.14.15 MACOS: darwin x64

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

This list contains all of the events supported by angular and their syntax:

(click)="myFunction()"      
(dblclick)="myFunction()"   

(submit)="myFunction()"

(blur)="myFunction()"  
(focus)="myFunction()" 

(scroll)="myFunction()"

(cut)="myFunction()"
(copy)="myFunction()"
(paste)="myFunction()"

(keyup)="myFunction()"
(keypress)="myFunction()"
(keydown)="myFunction()"

(mouseup)="myFunction()"
(mousedown)="myFunction()"
(mouseenter)="myFunction()"

(drag)="myFunction()"
(drop)="myFunction()"
(dragover)="myFunction()"

As you can see the onkey event doesn't exist and you should implement your logic with keyup, keydown or keypress(guess you want to use is this)

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!