本文整理匯總了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({}));
});