我习惯于在 HTML 模板中看到旧 Angular (< 10) 版本中的哈希,以将 DOM 元素声明为变量。
但在 Angular 10 中,我发现了在组件类中使用散列的示例。
class Product {
#name: string;
get name(): string {
return this.#name;
}
}
谁能向我解释它是如何工作的?
我习惯于在 HTML 模板中看到旧 Angular (< 10) 版本中的哈希,以将 DOM 元素声明为变量。
但在 Angular 10 中,我发现了在组件类中使用散列的示例。
class Product {
#name: string;
get name(): string {
return this.#name;
}
}
谁能向我解释它是如何工作的?