angular - Resolve id in pipe with a service -
i resolve id pipe. i think isn't best way call service/api every time? is better store countries before? how return country name within pipe? service: getcountry(id:number) { return this._http.get(this.apiurl + "/country/" + id).map(res => res.json()); } pipe: export class resolvepipe implements pipetransform { constructor(public _formdataservice: formdataservice) {} transform(value: number, args: any[]): { this._formdataservice.getcountry(value).subscribe( data => console.log(data[0].name) ) } } edit: <tr (click)="showprofile(customer)" *ngfor="let customer of (customers | search:term)"> <td>...</td><td>{{customer.country_id | resolve | async}}</td> </tr> first need return observable . when call subscribe() subscription returned. need return transform() hence added return export class resolvepipe implements pipetransform { constructor(public _form