This is a migrated thread and some comments may be shown as answers.

Angular 7 and onchange in textbox

2 Answers 199 Views
Conversational UI
This is a migrated thread and some comments may be shown as answers.
CRISTIAN
Top achievements
Rank 1
CRISTIAN asked on 05 Dec 2019, 03:26 PM

Hello,

I was reading about "typing" in message where if it is true a "typing animation" will be displayed in the chat.

But how could I to know in angular 7 when the user is typing words in the textbox chat for send a notification to other user? I was thinking in do some onchange subscription by DOM selector in angular 7 but I cant find the way...

Please could you help me?

Thanks in advance.

2 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 09 Dec 2019, 02:46 PM

Hi Cristian,

A possible approach to achieve the desired custom implementation is to listen for user input by using addEventListener method in the ngOnInit hook:

  ngOnInit() {
    const input = document.querySelector(".k-message-box");
    input.addEventListener("input", e => {
      ...
    });
  }

The animation can be shown or hidden depending on the typed characters:

https://stackblitz.com/edit/angular-ycbda6-zwiejt?file=app/app.component.ts

I hope this points you in the right direction. Let me know if I can assist any further.

Regards,
Martin
Progress Telerik

Get quickly onboarded and successful with your Telerik and Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
CRISTIAN
Top achievements
Rank 1
answered on 09 Dec 2019, 02:51 PM

"I hope this points you in the right direction."

Yes, this is what i was looking for!!

Thank very much.

Tags
Conversational UI
Asked by
CRISTIAN
Top achievements
Rank 1
Answers by
Martin
Telerik team
CRISTIAN
Top achievements
Rank 1
Share this question
or