0
Hello, I used the routerLink that passes an id to the url, which looks for this id and step as parameter for the function that searches the data of the api, but when I click on my link it redirects to the route I want, but it does not show my data that I am iterating, and the api return array is Undefined. But if I reload the route again then yes it shows the data:
This is my link
<a routerLink="/wines/{{uvas.id_uva}}">{{uvas.uva}}</a></li>
My Component
ngOnInit() {
this.Wine = this.route.paramMap.pipe(
switchMap((params: ParamMap) =>
this._dataService.getWine(params.get('id'))
);
}
My Service
getWine(id): Observable<IWine> {
return this.http.get<IWine>(`http://localhost:8888/exemplo/${id}`);
}
I will comment on the problem I had, all the answers that were posted here were right and working, the problem was in the angular2-materialize Carousel that I am using, the data is being iterated in this Carousel after it was already loaded, and then not loading the data that came from the service...
– Patric Pippi