Sep 1, 2018 · 1 min read
Did you know that you can use template literals in TypeScript?
To use template literals, use 2 backlashes for the string and a dollar sign with curly brackets for the literals.
Here’s an example syntax:
getTopHeadlines() {
return this.http.get(`https://newsapi.org/v2/top-headlines?country=us&category=business&apiKey=${this.key}`;
)}