THis is the feature not calling api mutiple times.
refer Link
ts.
this.response=this.shareds.getHubList()
this.getHubList();
this.getHubList();
}
getHubList(){
this.response.subscribe((res:any)=>{
console.log(res)
})
}
service
export class SharedsameApiDataService {
m_apiUrl=environment.m_apiurl;
constructor(private http: HttpClient) {}
getTodosList() {
return this.http.get(this.m_apiUrl+'products/getLookup').pipe(shareReplay());
}
getHubList() {
return this.http.get('http://localhost:8080/api/hubs/get').pipe(shareReplay());
}
1.Here hub list api need in mutiple componet but calling api using shareReplay
No comments:
Post a Comment