Hi
i get post from wp api site
http://www.jenyar.com/wp-json/wp/v2/songs?_embed
in field ‘.cd_meta.artist’ of above store artist id
and i have http://www.jenyar.com/wp-json/wp/v2/artists?_embed that have data of artist and name
how show name of artist ?
i think code be like this
getArtistName(artist_id){
this.api.get('songs?_embed&per'+ this.artist_id)
return item.title.rendered
}
thanks
I don’t.
You take a parameter and ignore it. It has no type. Neither does the function. You call a get()
method for which we have no idea what it returns, but I guess that doesn’t matter because you aren’t paying attention to it anyway. You feed it an object property, which makes no sense because presumably you wanted to use the parameter you passed in. Then we are returning two levels deep of access into a variable not declared anywhere in sight, nor with any hope that anything we have done here would have modified it in any way.
If you’re still reading, follow the patterns documented in here.