Answer the question
In order to leave comments, you need to log in
How to get an image using Get requests?
there is an ip, there is an image, how can I get it and display it on the page?
I'm trying to do this, but it doesn't work:
service
getCategoryLogo(id: number) {
this.categoryLogoUrl=this.categoryLogoUrl+'/'+id+'/logo';
return this.http.get(this.categoryLogoUrl, {headers: this.headers})
}
getCategoryLogo(id: number){
this.categoryService.getCategoryLogo(id)
.subscribe(
categoryLogo => this.categoryLogo = categoryLogo
)
}
<img src='getCategoryLogo(category.id)' alt="logo">
Answer the question
In order to leave comments, you need to log in
http.get returns Observable from rxjs. This object has corresponding methods, you can subscribe to it.
Here is an example https://angular.io/docs/ts/latest/guide/server-com...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question