Angular 如何计算插值中的表达式?

How does Angular evaluate expressions in interpolation?

阅读 Angular 文档中的 interpolation theory 给了我一个与 Angular 如何评估插值表达式及其对字符串的作用有关的问题。

来自文档

Angular evaluates all expressions in double curly braces, converts the expression results to strings, and links them with neighboring literal strings. Finally, it assigns this composite interpolated result to an element or directive property.

它 link 是 Angular 用来保持原始值不变的一种重复字符串吗?当他们离开原始功能而没有触及时,它是否像装饰者一样? 这更像是一个理论问题。

<!-- "The sum of 1 + 1 is not 4" -->
<p>The sum of 1 + 1 is not {{1 + 1 + getVal()}}.</p>

Angular 这个字符串有什么作用?

插值单向绑定数据。这意味着当使用插值绑定的字段值发生变化时,它也会在页面中更新。它不能更改字段的值。组件 class 的对象用作组件模板的数据上下文。所以要绑定在视图上的值必须分配给组件中的一个字段 class.

使用双花括号绑定字段的语法称为绑定表达式