I am new to angular 9.
I need to convert my data (I get them from api) to array and then to display last 5 records with keys and values to material modaldialog. I have seen this and some other suggestions, but it didn't work for me. What is the best approach to do that?
This is what I have try so far:
parent component:
openDialogNewNotify(): void {
this.httpClient.get<Ticket[]>(this.API_URL + '/AllIssues').subscribe(data => {
this.dataChange.next(data);
//const objectArray = Object.entries(data);
this.dialog.open(NotifyNewComponent, {
width: '320px',
height: '200px',
data: {
Issue: // What I need to put here?
},
});
}
html:
<div *ngFor="let item of data | keyvalue">
{{item.key}}:{{item.value}}
</div>