Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

166
Views
Angular: @Inject(MAT_DIALOG_DATA) - NgFor only supports binding to Iterables such as Arrays

I am sending data from a component page to a dialog.

I am able to receive the data, but when I try to use it in ngFor I get the error:

Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays

I've looked through 9 different SO articles on this error but I still can't seem to solve. My original code was:

Typescript:

(interface file)

export interface IPersonInternalNotes {
PersonID       : number;
Note            : string;
CreatedBy       : number;
CreatedByText   : string;
CreateDate      : string;
ModifiedBy      : number;
ModifiedByText  : string;
ModifiedDate    : string;
DeletedBy       : number;
DeletedByText   : string;
DeleteDate      : string;
}

(component file)

internalNotes: IPersonInternalNotes[] = [];
@Inject(MAT_DIALOG_DATA) public data: IPersonInternalNotes[] //in constructor)
this.internalNotes = this.data; //in  ngOnInit

HTML:

<tr *ngFor="let note of internalNotes">
      <td>{{note.CreateDate}}</td>
      <td>{{note.CreatedByText}}</td>
      <td>{{note.Note}}</td>
 </tr>  

Here is what the data looks like in the debugger:

data

I've tried many variations such as:

var myData = Object.keys(this.data).map((k) => this.data[k]);

for (let index = 0; index < myData.length; index++) {
     this.internalNotes.push(myData[index]);
}

and

this.data.forEach(element => {
     this.internalNotes.push(element);
});

and changing the html to

<tr *ngFor="let note of internalNotes.data">

but it got the error: “Property 'data' does not exist on type 'IPersonInternalNotes[]”

What am I missing? I must not be understanding something about the data type.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!