Explanation: I am utilizing the onChange function to detect when someone types the symbol @
.
Issue: While typing, the code currently checks the entire line each time a character is added, causing a lag in typing speed. I am looking to update the code so it only checks the most recently typed character.
Snippet of my code:
home.html
<ion-textarea #chat [(ngModel)]="tag" rows="1" cols="10" placeholder="Type your message..." (ngModelChange)='onChange($event)'></ion-textarea>
home.ts
onChange(eve)
{
if(eve.match(/@/g).length > 0)
The current implementation slows down the typing experience as it checks the entire line with each keystroke. I aim to optimize it to only examine the last character that was typed.