Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

177
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda