I am trying to use the template literals to natively achieve something similar to handlebars.
Here is my code:
let myTemplate = '<div class="tab" data-group="${id}">${name}</div>';
let doYourMagic = function(){
let tabInfo = {
id: 1234,
name: "Alex"
}
let { id, name } = tabInfo;
console.log(myTemplate);
} )
now, the issue is that when i run the doYourMagic function i get:
<div class="tab" data-group="${id}">${name}</div>
However, if I console.log one of those variables I get the correct value (for example, console.log(name) would get me my name value).
I would like to get the string properly interpolated, what am I doing wrong?