Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question / Bug] recent is not working on ngOnInit. #409

Open
KennyEng12 opened this issue Oct 3, 2022 · 0 comments
Open

[Question / Bug] recent is not working on ngOnInit. #409

KennyEng12 opened this issue Oct 3, 2022 · 0 comments

Comments

@KennyEng12
Copy link

Hi, we are using version: 6.2.0 on Angular Typescript 13.

We are facing an issue with the recent is showing blank (image shown below) even we assigned the value to recent:
image

Here is our HTML code:

<emoji-mart emoji="" [showSingleCategory]="true"
    [recent]="recentlyUsed" (emojiSelect)="selectedEmojiEvent($event)" title="Please choose..." set="twitter"
    [darkMode]="false">
</emoji-mart>

Here is our Angular Typescript code:

export interface RecentlyUsedEmojiTable {
    id: string;
    lastUsedDateTime: Date;
}

recentlyUsed: string[] = [''];

getRecentlyUsedEmoji(): Promise<RecentlyUsedEmojiTable[]> {
    return new Promise<RecentlyUsedEmojiTable[]>((resolve, reject) => {
        db.recentlyUsedEmoji.orderBy('lastUsedDateTime').toArray().then((results) => {
            resolve(results);
        });
    });
}

ngOnInit(): void {
  this.getRecentlyUsedEmoji().then((results) => {
    if (results.length > 0) {
      for (const result of results) {
        this.recentlyUsed.push(result.id);
      }
    }
  });
}

But the recent emojis are showed after we clicked on any categories and back to recent category.
So we are wondering if there is an API to request in order to refresh the recent category or this is a bug?

Thanks,
Kenny.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant