我很困惑这两种数据绑定方式之间的差异。Angular2:属性绑定组件内的属性
在我的组件我有属性:stringInterpolation = This is string interpolation;
在我的HTML我结合这个属性在输入值属性:<input type="text" value="{{stringInterpolation}}">
我已阅读,我还可以在属性绑定以另一种方式:<input type="text" [value]="stringInterpolation">
它在文本框内输出相同的值。
下面是从两个输入开发工具的检查:
<input _ngcontent-qdj-2="" type="text" ng-reflect-value="This is string interpolation">
和
<input _ngcontent-qdj-2="" type="text" ng-reflect-value="This is string interpolation">
他们都是相同的。
我的问题是:value="{{stringInterpolation}}
与[value]="stringInterpolation"
有什么不同?