本文整理匯總了TypeScript中@angular/forms.FormArray.disable方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript FormArray.disable方法的具體用法?TypeScript FormArray.disable怎麽用?TypeScript FormArray.disable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@angular/forms.FormArray
的用法示例。
在下文中一共展示了FormArray.disable方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should clear out array errors when disabled', () => {
const arr = new FormArray([new FormControl()], () => ({'expected': true}));
expect(arr.errors).toEqual({'expected': true});
arr.disable();
expect(arr.errors).toEqual(null);
arr.enable();
expect(arr.errors).toEqual({'expected': true});
});
示例2: it
it('should not emit status change events when emitEvent = false', () => {
c.statusChanges.subscribe(() => logger.push('control'));
a.statusChanges.subscribe(() => logger.push('array'));
form.statusChanges.subscribe(() => logger.push('form'));
a.disable({emitEvent: false});
expect(logger).toEqual([]);
a.enable({emitEvent: false});
expect(logger).toEqual([]);
});
示例3: it
it('should re-populate async array errors when enabled from a child', fakeAsync(() => {
const arr = new FormArray([new FormControl()], null, asyncValidator('expected'));
tick();
expect(arr.errors).toEqual({'async': true});
arr.disable();
expect(arr.errors).toEqual(null);
arr.push(new FormControl());
tick();
expect(arr.errors).toEqual({'async': true});
}));
示例4: setDisabledState
setDisabledState(isDisabled: boolean): void {
isDisabled ? this.formList.disable() : this.formList.enable();
}