How to search using @ and # tags in input?

Hello, I am making a post similar to a Facebook post, when I post data in the post when I type “@” to search data that return users names and if I type “#” first to call API and return available tags in ionic 4.

Here what I have done:

page.html

      <ion-item>
        <ion-textarea rows="3" (ionInput)="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");
    }
  }

I did like this but it’s not working…