FormArray from reactive forms
以及如中所述的阵列或地图中的对象方法
this question
.通常我会使用前者,如果绝对必要,则使用后者-但我想知道是否可以使用
只是
boolean
价值观
样板
<div>
<h2>Hello {{name}}</h2>
</div>
<input type="checkbox" *ngFor="let item of items; let i = index;" [(ngModel)]="items[i]"/>
组成部分
@Component({
selector: 'my-app',
template: `...`,
})
export class App {
name:string;
items = [false, false, true];
constructor() {
this.name = `Angular! v${VERSION.full}`
}
}
Live example on Plunker