【问题标题】:What is the name of the ${} notation in Angular2 (TypeScript) [duplicate]Angular2(TypeScript)中 ${} 符号的名称是什么[重复]
【发布时间】:2017-05-29 18:30:46
【问题描述】:

我看到Angular2 tutorial 中使用了以下语法

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

引用了哪些

export const RED = '#1976d2';

我没有在文档中看到这种语法,我不知道如何查找它。是否已弃用?

【问题讨论】:

标签: angular typescript


【解决方案1】:

这与 Angular2 无关,它是纯 TypeScript 字符串插值或 Template Strings,并且它仅适用于 .ts 文件,但不适用于 .html 文件,当模板内容位于与组件类不同的文件中时.

另见https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/template_strings

【讨论】:

    猜你喜欢
    • 2016-10-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-15
    • 2018-08-08
    • 2011-01-17
    • 2014-06-21
    相关资源
    最近更新 更多