Angular2の新機能です。 iamバインディング属性は、以前は次のようにしていました。Angular2の[attr.attributeName]と[attributeName]を持つ属性のバインドの相違点
例1:
<input type="number" [max]="variableName">
例2:
<select [(ngModel)]="selectedItem">
<option *ngFor="let item of itemList" [value]="item.value" [selected]="selectedItem==item.value">{{item.name}}</option>
</select>
いくつかの回失敗して使用されるこれらのバインディング。
次に、attrという接尾辞で属性をバインドするために、次の構文を使用しました。それのための。
例1:
<input type="number" [attr.max]="variableName">
例2:
<select [(ngModel)]="selectedItem">
<option *ngFor="let item of itemList" [value]="item.value" [attr.selected]="selectedItem==item.value">{{item.name}}</option>
</select>
魔法のようにいくつかの時間を仕事に使用されるこれらの構文。
これら2つのバインディングの違いを学ぶのを手伝ってください。[attributename]
と[attr.attributeName]
これらの特定の構文を使用することが重要です。
有用な情報ありがとうございます。 –