angular - Can't get objectname out of objectobservable -


i got issue wane try data db. receive data cant display cause object instead of strings. how can these object strings have tried quiet things nothing seems working.

component.ts

 this.artistitems = af.database.object('/users/'+this.artistid, {preservesnapshot: true});     this.artistitems.subscribe(snapshot => {       this.artistvalues = snapshot.val();       this.artistitemsid = this.artistvalues.releases;       console.log(this.artistitemsid)     }); 

output in console artistitemsid

aroundthefur:object b-sides&rarities:object diamondeyes(deluxe):object gore:object koinoyokan:object saturdaynightwrist(explicitversion):object thestudioalbumcollection:object 

database

database

everything try put in component.html crashes have no idee how can values out of object instead of getting object itself

when have in component.html

<ul>     <li *ngfor="let item of artistitemsid">       {{ item.value }}     </li>   </ul> 

i recieve error

inline template:8:12 caused by: cannot find differ supporting object '[object object]' of type 'object'. ngfor supports binding iterables such arrays.

if i'm not mistaken want display list of keys artist releases: aroundthefur, b-sides&rarities, etc.

so can extract keys releases object:

this.artistitems = af.database.object('/users/'+this.artistid, {preservesnapshot: true}); this.artistitems.subscribe(snapshot => {   this.artistvalues = snapshot.val();   this.artistitemsid = object.keys(this.artistvalues.releases); }); 

and iterate ngfor on resulting array:

<ul>   <li *ngfor="let item of artistitemsid">     {{ item}}   </li> </ul> 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -