I have code in my ngOnInit to get the translation for some particular text. It calls the following function:
async getEmailTranslation() {
const email$ = this.translate.get('SUPPORT_TRANSLATE.EMAIL');
this.email = await firstValueFrom(email$);
console.log(this.email);
console.log(typeof this.email);
}
When I check the console, I am seeing "Email" and "string" returned from the two console.log() statements, which is exactly what I am expecting.
In the template, when I render {{ this.email }}, the template shows [object Object] instead of the string.
email is defined as:
email: string;
What am I missing?
The strange thing is with another translation, this is working as expected:
async getWebsiteTranslation() {
const website$ = this.translate.get('SUPPORT_TRANSLATE.WEBSITE');
this.website = await firstValueFrom(website$);
}
In this case, when displaying {{ this.website }} in the template, it is properly rendering the string I am expecting.