Unable to get an image from API

Viewed 32
1 Answers

Your error screenshot lead me to this line that uses template literals that are not enclosed in backticks. Additionally, this.url already has a leading / appended to it, so there's no need to add one in the URL passes to http.get.

Replace:

return this.http.get('${this.url}/${name}')

with:

return this.http.get(`${this.url}${name}`)

Relevant MDN page on template literals.

Related