In ES6, there is a Template String function, that is, we can form / concatenate a string as follows (with a reverse tag)
const name = 'John'; const intro = 'My name is ${name}'; console.log(intro);
And in the Angular 2 Component template, we have double braces for interpolation, which we can use to insert values ββfrom a variable.
@Component({ selector: 'selector-test-tag', template: ' <div> <p>My name is ${name}</p> <p>My name is {{name}}</p> </div> ' }) export class Test { name: string; }
Question. Is there a reason you choose one from the other?
source share