With ES6 string templates polyfill I can do following
var template = require('es6-template-strings');
//external input
var templateStr = "Hello, ${name}!";
var data = {name: "John"};
console.log(template(templateStr, data)); //>>Hello, John!
Is it possible to do the same using native ES6 templates?
Note: I get templateStr dynamically (in my case that is from json file with error messages), so I cannot use template strings syntax directly (like var str = Hello, ${name}!
;)
There was the same question and answer is it is not possible without using eval.