Doflamingo19
Doflamingo19

Reputation: 1629

How handles keyup event a input type="text"

I need to take what the user writes in input, so I do this ( in my html page):

<label>Filter Name</label>
<input type="text" (keyup.enter)="onKeyEnter()" name="book_name"/>

and in my .ts i do:

onKeyEnter(){
    console.log("Home");
  }

The problem is the console it doesn't print console. Anyone cna help me?

Upvotes: 0

Views: 59

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222522

If you need to handle keyup you can use (keyup) instead. keyup.enter works only for Enter key

<input type="text" (keyup)="onKeyEnter()" name="book_name"/>

STACKBLITZ DEMO

Upvotes: 1

Related Questions