Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71019

Work with wp api and get name by id in ionic

$
0
0

@ebeliejinfren wrote:

i have music site and in api have artists and songs router : /wp-json/wp/v2/artists /wp-json/wp/v2/songs

in songs - evry songs has artist field that store Song’s artists id

i want by gettings songs the artist’s id of songs convert to artist name

i find this from a tutorial but not work

getArtistName(item.cd_meta.artist[0])

getArtistName(artist_id:number){
let artist_name:string ='';
this.api.Artists.forEach(element =>{
  if (element.id === artist_id){
    artist_name = element.name;
  }
});


  return artist_name;
}

thanks

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71019

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>