angular中的那些绑定方法有什么区别?

what is the difference between those binding methods in angular?

在 angular 教程中有这个例子:

<h3>
    <a [title]="product.name + ' details'">
      {{ product.name }}
    </a>
  </h3>

如果我这样写它会很好用:

<h3>
    <a title="{{product.name + ' details'}}">
      {{ product.name }}
    </a>
  </h3>

有什么区别?最佳做法是什么?

第一个是 属性 使用注释 []

绑定

第二个是普通插值

插值和 属性 绑定之间的区别。

Interpolation is a special syntax that Angular converts into property binding. It’s a convenient alternative to property binding.

Property Binding: to set an element property to a non-string data value, you must use property binding.

因此要显示 none 任何类型的数据(包括字符串)值,请使用 Property Binding 或者如果要显示普通字符串值,请使用 {{}} 插值

来源:https://www.codementor.io/adekunleoyaniyi/interpolation-vs-property-binding-in-angular2-eu1tzbyn4