Uncaught (in promise): Error: Cannot find a differ supporting object '{"created": of type string

#1

Uncaught (in promise): Error: Cannot find a differ supporting object '{“created”:… of type string

and lower down it says this: NgFor only supports binding to Iterables such as Arrays

in my .TS file,

public items:any = [];

ionViewWillLoad() {
    const moredata = this.navParams.get('data');
    console.log('here we go: '+moredata);
    this.items = JSON.stringify(moredata)
  }

in my html file:

<ion-content padding>
    <ion-item text-wrap *ngFor="let item of items">
      <h1>testings</h1>
      <p>{{item | json}}</p> 
    </ion-item>
</ion-content>
#2

This is an example of why I keep complaining about any abuse. If you give items a proper type, your IDE and/or build tools will tell you exactly what is going wrong and where.

Hint: you’re assigning the result of JSON.stringify to it, which is a string. As the error message tells you, ngFor can’t iterate over strings.

#3

Ok thank, I changed it slightly and now I get: Cannot find a differ supporting object ‘[object Object]’ of type 'object’

TS

items:any = [];

ionViewWillLoad() {
    const moredata = this.navParams.get('data');
    console.log('here we go: '+moredata);
    this.items = moredata
  }

html

<ion-content padding>
    <ion-item text-wrap *ngFor="let item of items">
      <h1>testings</h1>
      <p>{{item | json}}</p> 
    </ion-item>
</ion-content>
#4

You totally ignored the entire point of my previous post:

STOP ABUSING any.

#5

ah, so I changed Items to

items = [];

I now get this error:

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

#6

can anyone help here please?