I want to do like twitter posts where users writing his post and when writing @ to open user list and click to add in the input. so that way you can tag anyone in your post. For these things I tried to check first char yeah it's working but in input anywhere I type @ to run a function or open user list.
page.html
<ion-item>
<ion-textarea rows="3" (input)="searchPeople($event)" cols="20" formControlName="comment"
placeholder="Tweet your reply" spellcheck="true" autoComplete="true" autocorrect="true" autofocus required>
</ion-textarea>
</ion-item>
page.ts
searchPeople(ev: any) {
// set val to the value of the searchbar
let val = ev.target.value;
let firstchar = val.charAt(0);
if (firstchar === "@") {
console.log("search people");
}
else if (firstchar === "#") {
console.log("hash tag");
} else {
console.log("error");
}
}