本文整理汇总了TypeScript中@angular/forms.FormArray.setControl方法的典型用法代码示例。如果您正苦于以下问题:TypeScript FormArray.setControl方法的具体用法?TypeScript FormArray.setControl怎么用?TypeScript FormArray.setControl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/forms.FormArray
的用法示例。
在下文中一共展示了FormArray.setControl方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should only emit value change event once', () => {
const logger: string[] = [];
const c2 = new FormControl('new!');
a.valueChanges.subscribe(() => logger.push('change!'));
a.setControl(0, c2);
expect(logger).toEqual(['change!']);
});
示例2: add
public add() {
const newItem = new Object();
const keys = Object.keys(this.csDefinition.childProperty);
keys.forEach((value) => {
newItem[value] = '';
});
this.collection.push(newItem);
const index = this.collection.indexOf(newItem);
this.collectionForms.setControl(index, this.formBuilder.group({}));
}
示例3:
movingGroups.forEach((formControl, idx) => {
let position;
if (moveUp) {
position = idx === 0 ? newIndex : index + idx - 1;
} else {
position = idx === movingGroups.length - 1 ? newIndex : newIndex + idx + 1;
}
formArray.setControl(position, formControl);
});
示例4:
collection.forEach((value, i) => {
this.collectionForms.setControl(i, this.buildControl(value));
});
示例5: add
public add() {
const newItem = '';
const index = this.collection.push(newItem) - 1;
this.collectionForms.setControl(index, this.buildControl(newItem) );
}
示例6:
collection.forEach((value, i) => {
this.collectionForms.setControl(i, this.formBuilder.group({}));
});