Using the angular mentions library, I successfully incorporated a textarea that enables me to mention multiple users.
Is there a method to store the IDs of the selected users? Ideally, I would like to save them as an array of strings.
For instance: If I choose users Name 1, Name 2, Name 3 .... I desire to save their IDs rather than names. ["1", "2", "3"]
Could someone lend me a hand with this?
Thank you!
HTML
<div [mention]="items" class="form-control" contenteditable="true" style="border:1px lightgrey solid;min-height:88px" [mentionConfig]="{triggerChar:'@',labelKey:'name'}"></div>
Component.ts
items: string[];
constructor(private userService: UserService) {}
ngOnInit() {
this.userService.getUsers().subscribe(
(val: any[]) =>{
this.items = val;
}
)
}