本文整理汇总了TypeScript中@angular/forms.FormArray.removeAt方法的典型用法代码示例。如果您正苦于以下问题:TypeScript FormArray.removeAt方法的具体用法?TypeScript FormArray.removeAt怎么用?TypeScript FormArray.removeAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/forms.FormArray
的用法示例。
在下文中一共展示了FormArray.removeAt方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should support removing', () => {
a.push(c1);
a.push(c2);
a.push(c3);
a.removeAt(1);
expect(a.controls).toEqual([c1, c3]);
});
示例2: inject
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
a.valueChanges.subscribe({
next: (value: any) => {
expect(value).toEqual(['old1']);
async.done();
}
});
a.removeAt(1);
}));
示例3: adaptFormArraySize
export function adaptFormArraySize(formArray: FormArray, size: number, elementProducer: (index: number) => AbstractControl) {
while (formArray.length !== size) {
if (formArray.length > size) {
formArray.removeAt(0);
} else if (formArray.length < size) {
formArray.push(elementProducer(formArray.length));
}
}
}
示例4: removeFormArrayGroup
removeFormArrayGroup(index: number, formArray: FormArray, formArrayModel: DynamicFormArrayModel): void {
formArray.removeAt(index);
formArrayModel.removeGroup(index);
}
示例5:
this.children.forEach((child, index) => {
if (index >= valLen) {
this.model.removeAt(index)
}
})
示例6: deleteFormArray
deleteFormArray(i) {
this.parentFormArray.removeAt(i);
}
示例7: removeFromCollection
// ---
// PRIVATE METHODS.
// ---
// I remove the given control from the given array. Mutates the array.
private removeFromCollection( collection: FormArray, item: FormControl ) : void {
collection.removeAt( collection.controls.indexOf( item ) );
}
示例8: remove
public remove(index: number) {
this.collection.splice(index, 1);
this.collectionForms.removeAt(index);
}
示例9: loeschen
loeschen(index: number) {
this.positionen.removeAt(index);
}
示例10: remove
public remove(item: any) {
const index = this.collection.indexOf(item);
this.collection.splice(index, 1);
this.collectionForms.removeAt(index);
}