Hello everyone, I am new to working with Angular and could use some assistance. I have retrieved data in my application through an API response, which is in the format of an array of objects. I have successfully used *ngFor to iterate over this data. Within the data, there is a field called email. I want to display only the name portion of the email address without including "@gmail.com" or "@yahoo.com". In other words, I only want to display the text up to the '@' symbol. I attempted to achieve this using the split method but was unsure how to implement it within *ngFor. Could someone please provide guidance on how to accomplish this? Below is the HTML code snippet:
<div *ngFor="let content of listContent.content">
<p>{{content.email}}</p>
<p>{{content.name}}</p>
</div>
The TypeScript code snippet is as follows:
fetchContents() {
this.MessagesService.findAll(id).subscribe(data => {
this.listContent = data;
});
}
I need to manipulate the email text before displaying it in the HTML output.