Get name + id of a service with Angular

1

Dear greetings, I am working with angle obtaining the result of a service, which I need to obtain the name of genres, but the parameter that the service for the gender item sends me is: genre_ids, which prints the id numbers corresponding, I need to get the names of genders by id.

this is the service and the html where I get the results,

import { Injectable } from '@angular/core';
import { Http } from "@angular/http";

@Injectable()
export class PeliculasService {

  results:any[] = [];
  cargando:boolean = false;

  constructor( private http:Http) {
    this.carga_info();
  }

  public carga_info() {
    this.http.get("https://api.themoviedb.org/3/discover/movie?api_key=041a697538db4c29730095424a6df704&primary_release_date.gte=2018-06-28&primary_release_date.lte=2018-07-19")
      .subscribe(data => {
        console.log(data.json());
        this.cargando = true;
        this.results = data.json().results;
      })
  }
}
<ul class="listado">
    <li *ngFor="let item of _ps.results">
      <div class="box">
        <img src="https://image.tmdb.org/t/p/w500/{{item.poster_path}}">
        <div class="info-1">
          <div class="titulo">{{ item.title }}</div>
          <div class="genero">{{ item.genre_ids }}</div>
        </div>
    </li>

  </ul>

One doubt I have, is that the service throws me genre_ids, but no names or a name field, to get them, I do not know if you need to make another request to get those names and then include them in that parameter, anyway try Do it like this from this other request, but without success, I'll leave the other service if necessary.

link

    
asked by Sixto Mujica 21.07.2018 в 19:09
source

0 answers