Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the name of the ${} notation in Angular2 (TypeScript) [duplicate]

I have seen the following syntax used in an Angular2 tutorial

(click)="choose('${RED}')"

which references

export const RED = '#1976d2';

I have not seen this syntax in the documentation and I'm not sure how to look it up. Is it deprecated?

like image 250
Nate May Avatar asked Oct 15 '25 03:10

Nate May


1 Answers

This is not Angular2 related, it's pure TypeScript string interpolation or Template Strings, and it only works in .ts files, but not in .html files when you have the template content in a different file than the component class.

See also https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/template_strings

like image 175
Günter Zöchbauer Avatar answered Oct 17 '25 18:10

Günter Zöchbauer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!