I want to display data from this console.log and i have a error.
Error is: Error: Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays.
This is part of the code:
this.dbFire.database.ref('found').orderByChild('author_email')
.equalTo(this.email)
.once('value')
.then(snapshot => snapshot.val())
.then((data) => {
this.getUserPosts = data;
console.log(this.getUserPosts);
});
Thank you !
// declare variable as empty array
getUserPosts: any[] = [];
this.dbFire.database.ref('found').orderByChild('author_email').equalTo(this.email).once('value')
.then(snapshot => snapshot.val())
.then((data) => {
// push data
this.getUserPosts.push(data);
console.log(this.getUserPosts);
});
<li * ngFor="let user of getUserPosts" >
{{ user.author_email}}
</li>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.