This issue is new to me, and I believe it stems from the promise being used here causing delays. Does anyone have a solution to this? I've included the snippet of code where the error occurs, the complete class, and the specific error at the end.
Code snippet with error:
this.languages = await this.languageService.getAll().toPromise()
this.languages.forEach(async (language) => {
this.languageOption = new DropdownOption
this.languageOption.set (
language.getName(),
language.getId()
)
Language class:
export class Language {
private id: number;
private name: string;
private code: string;
private charset: string;
private isDefault: boolean;
private isActive: boolean;
private systemId: number;
public constructor() {
this.id = null;
this.name = '';
this.code = '';
this.charset = '';
this.isDefault = false;
this.isActive = false;
this.systemId = null;
}
// Remaining methods in the Language class...
}
Error:
Uncaught (in promise): TypeError: language.getName is not a function TypeError: language.getName is not a function