_id
stringlengths
21
254
text
stringlengths
1
93.7k
metadata
dict
angular/packages/forms/test/typed_integration_spec.ts_24405_32369
describe('FormArray', () => { it('supports inferred arrays', () => { const c = new FormArray([new FormControl('', {nonNullable: true})]); { type ValueType = string[]; let t: ValueType = c.value; let t1 = c.value; t1 = null as unknown as ValueType; } c.at(0); ...
{ "end_byte": 32369, "start_byte": 24405, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/typed_integration_spec.ts" }
angular/packages/forms/test/typed_integration_spec.ts_32373_40582
describe('FormBuilder', () => { let fb: FormBuilder = new FormBuilder(); beforeEach(() => { fb = new FormBuilder(); }); describe('should work in basic cases', () => { it('on FormControls', () => { const fc = fb.control(42); expect(fc.value).toEqual(42); }); it(...
{ "end_byte": 40582, "start_byte": 32373, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/typed_integration_spec.ts" }
angular/packages/forms/test/typed_integration_spec.ts_40588_49574
describe('should build FormRecords', () => { it('from objects with plain values', () => { const c = fb.record({foo: 'bar'}); { type ControlsType = {[key: string]: FormControl<string | null>}; let t: ControlsType = c.controls; let t1 = c.controls; t1 = null a...
{ "end_byte": 49574, "start_byte": 40588, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/typed_integration_spec.ts" }
angular/packages/forms/test/typed_integration_spec.ts_49578_56358
describe('NonNullFormBuilder', () => { let fb: NonNullableFormBuilder; beforeEach(() => { fb = new FormBuilder().nonNullable; }); describe('should build FormControls', () => { it('non-nullably from values', () => { const c = fb.control('foo'); { type RawValueType ...
{ "end_byte": 56358, "start_byte": 49578, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/typed_integration_spec.ts" }
angular/packages/forms/test/typed_integration_spec.ts_56360_59874
describe('Untyped Class', () => { describe('UntypedFormControl', () => { it('should function like a FormControl with the default type', () => { const ufc = new UntypedFormControl('foo'); expect(ufc.value).toEqual('foo'); }); it('should default to null with no argument', () => { const uf...
{ "end_byte": 59874, "start_byte": 56360, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/typed_integration_spec.ts" }
angular/packages/forms/test/form_control_spec.ts_0_5813
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {fakeAsync, tick} from '@angular/core/testing'; import {AsyncValidatorFn, FormArray, FormControl, FormGroup, ...
{ "end_byte": 5813, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/form_control_spec.ts" }
angular/packages/forms/test/form_control_spec.ts_5819_14444
describe('validator', () => { it('should run validator with the initial value', () => { const c = new FormControl('value', Validators.required); expect(c.valid).toEqual(true); }); it('should rerun the validator when the value changes', () => { const c = new FormControl('value'...
{ "end_byte": 14444, "start_byte": 5819, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/form_control_spec.ts" }
angular/packages/forms/test/form_control_spec.ts_14450_24105
describe('asyncValidator', () => { it('should run validator with the initial value', fakeAsync(() => { const c = new FormControl('value', null!, asyncValidator('expected')); tick(); expect(c.valid).toEqual(false); expect(c.errors).toEqual({'async': true}); })); it('sh...
{ "end_byte": 24105, "start_byte": 14450, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/form_control_spec.ts" }
angular/packages/forms/test/form_control_spec.ts_24111_28070
describe('setValue', () => { let g: FormGroup, c: FormControl; beforeEach(() => { c = new FormControl('oldValue'); g = new FormGroup({'one': c}); }); it('should set the value of the control', () => { c.setValue('newValue'); expect(c.value).toEqual('newValue'); ...
{ "end_byte": 28070, "start_byte": 24111, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/form_control_spec.ts" }
angular/packages/forms/test/form_control_spec.ts_28076_35385
describe('reset()', () => { let c: FormControl; beforeEach(() => { c = new FormControl('initial value'); }); it('should reset to a specific value if passed', () => { c.setValue('new value'); expect(c.value).toBe('new value'); c.reset('initial value'); e...
{ "end_byte": 35385, "start_byte": 28076, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/form_control_spec.ts" }
angular/packages/forms/test/form_control_spec.ts_35391_39850
describe('valueChanges & statusChanges', () => { let c: FormControl; beforeEach(() => { c = new FormControl('old', Validators.required); }); it('should fire an event after the value has been updated', (done) => { c.valueChanges.subscribe({ next: (value: any) => { ...
{ "end_byte": 39850, "start_byte": 35391, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/form_control_spec.ts" }
angular/packages/forms/test/form_control_spec.ts_39856_47864
describe('disable() & enable()', () => { it('should mark the control as disabled', () => { const c = new FormControl(null); expect(c.disabled).toBe(false); expect(c.valid).toBe(true); c.disable(); expect(c.disabled).toBe(true); expect(c.valid).toBe(false); ...
{ "end_byte": 47864, "start_byte": 39856, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/form_control_spec.ts" }
angular/packages/forms/test/form_control_spec.ts_47872_53214
describe('disabled events', () => { let logger: string[]; let c: FormControl; let g: FormGroup; beforeEach(() => { logger = []; c = new FormControl('', Validators.required); g = new FormGroup({one: c}); }); it('should emit a statusChange ev...
{ "end_byte": 53214, "start_byte": 47872, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/form_control_spec.ts" }
angular/packages/forms/test/validators_spec.ts_0_8014
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {fakeAsync, tick} from '@angular/core/testing'; import { AbstractControl, AsyncValidator, AsyncValidato...
{ "end_byte": 8014, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/validators_spec.ts" }
angular/packages/forms/test/validators_spec.ts_8020_16077
describe('minLength', () => { it('should not error on an empty string', () => { expect(Validators.minLength(2)(new FormControl(''))).toBeNull(); }); it('should not error on null', () => { expect(Validators.minLength(2)(new FormControl(null))).toBeNull(); }); it('should no...
{ "end_byte": 16077, "start_byte": 8020, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/validators_spec.ts" }
angular/packages/forms/test/validators_spec.ts_16083_22439
describe('composeAsync', () => { describe('promises', () => { function promiseValidator(response: {[key: string]: any}): AsyncValidatorFn { return (c: AbstractControl) => { const res = c.value != 'expected' ? response : null; return Promise.resolve(res); }; ...
{ "end_byte": 22439, "start_byte": 16083, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/validators_spec.ts" }
angular/packages/forms/test/ng_control_status_spec.ts_0_1892
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {ChangeDetectionStrategy, Component} from '@angular/core'; import {FormControl, FormsModule, ReactiveFormsMod...
{ "end_byte": 1892, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/ng_control_status_spec.ts" }
angular/packages/forms/test/util.ts_0_2871
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {EventEmitter} from '@angular/core'; import {AbstractControl, AsyncValidatorFn, ValidationErrors} from '@angu...
{ "end_byte": 2871, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/util.ts" }
angular/packages/forms/test/BUILD.bazel_0_1648
load("//tools:defaults.bzl", "karma_web_test_suite", "ts_library", "zone_compatible_jasmine_node_test") load("//tools/circular_dependency_test:index.bzl", "circular_dependency_test") circular_dependency_test( name = "circular_deps_test", entry_point = "angular/packages/forms/index.mjs", deps = ["//packages...
{ "end_byte": 1648, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/BUILD.bazel" }
angular/packages/forms/test/form_group_spec.ts_0_8266
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {fakeAsync, tick, waitForAsync} from '@angular/core/testing'; import { AbstractControl, ControlEvent, F...
{ "end_byte": 8266, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/form_group_spec.ts" }
angular/packages/forms/test/form_group_spec.ts_8272_13224
describe('setValue', () => { let c: FormControl, c2: FormControl, g: FormGroup; beforeEach(() => { c = new FormControl(''); c2 = new FormControl(''); g = new FormGroup({'one': c, 'two': c2}); }); it('should set its own value', () => { g.setValue({'one': 'one', '...
{ "end_byte": 13224, "start_byte": 8272, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/form_group_spec.ts" }
angular/packages/forms/test/form_group_spec.ts_13230_19230
describe('patchValue', () => { let c: FormControl, c2: FormControl, g: FormGroup, g2: FormGroup; beforeEach(() => { c = new FormControl(''); c2 = new FormControl(''); g = new FormGroup({'one': c, 'two': c2}); g2 = new FormGroup({ 'array': new FormArray([new FormCon...
{ "end_byte": 19230, "start_byte": 13230, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/form_group_spec.ts" }
angular/packages/forms/test/form_group_spec.ts_19236_27670
describe('reset()', () => { let c: FormControl, c2: FormControl, g: FormGroup; beforeEach(() => { c = new FormControl('initial value'); c2 = new FormControl(''); g = new FormGroup({'one': c, 'two': c2}); }); it('should set its own value if value passed', () => { ...
{ "end_byte": 27670, "start_byte": 19236, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/form_group_spec.ts" }
angular/packages/forms/test/form_group_spec.ts_27676_35934
describe('contains', () => { let group: FormGroup; beforeEach(() => { group = new FormGroup({ 'required': new FormControl('requiredValue'), 'optional': new FormControl({value: 'disabled value', disabled: true}), }); }); it('should return false when the compo...
{ "end_byte": 35934, "start_byte": 27676, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/form_group_spec.ts" }
angular/packages/forms/test/form_group_spec.ts_35940_44145
describe('asyncValidator', () => { it('should run the async validator', fakeAsync(() => { const c = new FormControl('value'); const g = new FormGroup({'one': c}, null!, asyncValidator('expected')); expect(g.pending).toEqual(true); tick(1); expect(g.errors).toEqual({'asyn...
{ "end_byte": 44145, "start_byte": 35940, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/form_group_spec.ts" }
angular/packages/forms/test/form_group_spec.ts_44153_50185
it('should handle failing FormGroup validator resolving after successful child validator', fakeAsync(() => { const c = new FormControl( 'fcValue', null!, simpleAsyncValidator({timeout: 1, shouldFail: false}), ); const g = new FormGroup( {'one': c}, ...
{ "end_byte": 50185, "start_byte": 44153, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/form_group_spec.ts" }
angular/packages/forms/test/form_group_spec.ts_50193_57480
it('should handle failing FormArray validator resolving after successful child validators', fakeAsync(() => { const c1 = new FormControl( 'fcValue', null!, simpleAsyncValidator({timeout: 1, shouldFail: false}), ); const g = new FormGroup( {'one': c1}, ...
{ "end_byte": 57480, "start_byte": 50193, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/form_group_spec.ts" }
angular/packages/forms/test/form_group_spec.ts_57488_62483
it('should handle async validators in nested form groups / arrays', fakeAsync(() => { const c1 = new FormControl( 'fcValue', null!, simpleAsyncValidator({timeout: 1, shouldFail: false}), ); const g1 = new FormGroup( {'one': c1}, null!, ...
{ "end_byte": 62483, "start_byte": 57488, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/form_group_spec.ts" }
angular/packages/forms/test/form_group_spec.ts_62489_71867
describe('disable() & enable()', () => { it('should mark the group as disabled', () => { const g = new FormGroup({'one': new FormControl(null)}); expect(g.disabled).toBe(false); expect(g.valid).toBe(true); g.disable(); expect(g.disabled).toBe(true); expect(g.valid)...
{ "end_byte": 71867, "start_byte": 62489, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/form_group_spec.ts" }
angular/packages/forms/test/form_group_spec.ts_71873_74794
describe('updateTreeValidity()', () => { let c: FormControl, c2: FormControl, c3: FormControl; let nested: FormGroup, form: FormGroup; let logger: string[]; beforeEach(() => { c = new FormControl('one'); c2 = new FormControl('two'); c3 = new FormControl('three'); ...
{ "end_byte": 74794, "start_byte": 71873, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/form_group_spec.ts" }
angular/packages/forms/test/form_group_spec.ts_74800_82454
describe('emit `statusChanges` and `valueChanges` with/without async/sync validators', () => { const attachEventsLogger = ( control: AbstractControl, log: string[], controlName?: string, ) => { const name = controlName ? ` (${controlName})` : ''; control.statusChanges...
{ "end_byte": 82454, "start_byte": 74800, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/form_group_spec.ts" }
angular/packages/forms/test/form_group_spec.ts_82462_90519
describe('combination of multiple form controls', () => { it('should run the async validator on the FormControl added to the FormGroup and set status to `VALID`', fakeAsync(() => { const logs: string[] = []; const c1 = new FormControl('one'); const g1 = new FormGroup({'one': c1}); ...
{ "end_byte": 90519, "start_byte": 82462, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/form_group_spec.ts" }
angular/packages/forms/test/form_group_spec.ts_90525_93414
describe('pending', () => { let c: FormControl; let g: FormGroup; beforeEach(() => { c = new FormControl('value'); g = new FormGroup({'one': c}); }); it('should be false after creating a control', () => { expect(g.pending).toEqual(false); }); it('shou...
{ "end_byte": 93414, "start_byte": 90525, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/form_group_spec.ts" }
angular/packages/forms/test/template_integration_spec.ts_0_1369
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {CommonModule, ɵgetDOM as getDOM} from '@angular/common'; import {Component, Directive, ElementRef, forwardRe...
{ "end_byte": 1369, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/template_integration_spec.ts" }
angular/packages/forms/test/template_integration_spec.ts_1373_10711
escribe('basic functionality', () => { it('should support ngModel for standalone fields', fakeAsync(() => { const fixture = initTest(StandaloneNgModel); fixture.componentInstance.name = 'oldValue'; fixture.detectChanges(); tick(); // model -> view const input = fixture.debugEle...
{ "end_byte": 10711, "start_byte": 1373, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/template_integration_spec.ts" }
angular/packages/forms/test/template_integration_spec.ts_10717_17770
t('should set status classes involving nested FormGroups', async () => { const fixture = initTest(NgModelNestedForm); fixture.componentInstance.first = ''; fixture.componentInstance.other = ''; fixture.detectChanges(); const form = fixture.debugElement.query(By.css('form')).nativeElement;...
{ "end_byte": 17770, "start_byte": 10717, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/template_integration_spec.ts" }
angular/packages/forms/test/template_integration_spec.ts_17775_27991
escribe('blur', () => { it('should default updateOn to change', fakeAsync(() => { const fixture = initTest(NgModelForm); fixture.componentInstance.name = ''; fixture.componentInstance.options = {}; fixture.detectChanges(); tick(); const form = fixture.debugElement....
{ "end_byte": 27991, "start_byte": 17775, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/template_integration_spec.ts" }
angular/packages/forms/test/template_integration_spec.ts_27997_36398
escribe('submit', () => { it('should set control updateOn to submit properly', fakeAsync(() => { const fixture = initTest(NgModelForm); fixture.componentInstance.name = ''; fixture.componentInstance.options = {updateOn: 'submit'}; fixture.detectChanges(); tick(); c...
{ "end_byte": 36398, "start_byte": 27997, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/template_integration_spec.ts" }
angular/packages/forms/test/template_integration_spec.ts_36406_42178
t('should reset properly', fakeAsync(() => { const fixture = initTest(NgModelForm); fixture.componentInstance.name = 'Nancy' as string | null; fixture.componentInstance.options = {updateOn: 'submit'}; fixture.detectChanges(); tick(); const input = fixture.debugElement.qu...
{ "end_byte": 42178, "start_byte": 36406, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/template_integration_spec.ts" }
angular/packages/forms/test/template_integration_spec.ts_42184_49857
escribe('ngFormOptions', () => { it('should use ngFormOptions value when ngModelOptions are not set', fakeAsync(() => { const fixture = initTest(NgModelOptionsStandalone); fixture.componentInstance.options = {name: 'two'}; fixture.componentInstance.formOptions = {updateOn: 'blur'}; ...
{ "end_byte": 49857, "start_byte": 42184, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/template_integration_spec.ts" }
angular/packages/forms/test/template_integration_spec.ts_49861_55060
escribe('valueChange and statusChange events', () => { it('should emit valueChanges and statusChanges on init', fakeAsync(() => { const fixture = initTest(NgModelForm); const form = fixture.debugElement.children[0].injector.get(NgForm); fixture.componentInstance.name = 'aa'; fixture.detectCh...
{ "end_byte": 55060, "start_byte": 49861, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/template_integration_spec.ts" }
angular/packages/forms/test/template_integration_spec.ts_55064_62333
escribe('validation directives', () => { it('required validator should validate checkbox', fakeAsync(() => { const fixture = initTest(NgModelCheckboxRequiredValidator); fixture.detectChanges(); tick(); const control = fixture.debugElement.children[0].injector .get(NgForm) .c...
{ "end_byte": 62333, "start_byte": 55064, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/template_integration_spec.ts" }
angular/packages/forms/test/template_integration_spec.ts_62339_71487
t('changes on bound properties should change the validation state of the form', fakeAsync(() => { const fixture = initTest(NgModelValidationBindings); fixture.detectChanges(); tick(); const required = fixture.debugElement.query(By.css('[name=required]')); const minLength = fixture.debugEl...
{ "end_byte": 71487, "start_byte": 62339, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/template_integration_spec.ts" }
angular/packages/forms/test/template_integration_spec.ts_71493_79188
t('should validate min', fakeAsync(() => { const fixture = initTest(NgModelMinValidator); fixture.componentInstance.min = 10; fixture.detectChanges(); tick(); const input = fixture.debugElement.query(By.css('input')).nativeElement; const form = fixture.debugElement.children[0].injec...
{ "end_byte": 79188, "start_byte": 71493, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/template_integration_spec.ts" }
angular/packages/forms/test/template_integration_spec.ts_79194_87761
escribe('enabling validators conditionally', () => { it('should not include the minLength and maxLength validators for null', fakeAsync(() => { @Component({ template: '<form><input name="amount" ngModel [minlength]="minlen" [maxlength]="maxlen"></form>', standalone: false, ...
{ "end_byte": 87761, "start_byte": 79194, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/template_integration_spec.ts" }
angular/packages/forms/test/template_integration_spec.ts_87766_96375
t('should validate min and max', fakeAsync(() => { const fixture = initTest(NgModelMinMaxValidator); fixture.componentInstance.min = 5; fixture.componentInstance.max = 10; fixture.detectChanges(); tick(); const input = fixture.debugElement.query(By.css('input')).nativeElement; ...
{ "end_byte": 96375, "start_byte": 87766, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/template_integration_spec.ts" }
angular/packages/forms/test/template_integration_spec.ts_96379_104640
escribe('IME events', () => { it('should determine IME event handling depending on platform by default', fakeAsync(() => { const fixture = initTest(StandaloneNgModel); const inputEl = fixture.debugElement.query(By.css('input')); const inputNativeEl = inputEl.nativeElement; fixture.componentI...
{ "end_byte": 104640, "start_byte": 96379, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/template_integration_spec.ts" }
angular/packages/forms/test/template_integration_spec.ts_104642_107684
Component({ selector: 'ng-model-checkbox-validator', template: `<form><input type="checkbox" [(ngModel)]="accepted" [required]="required" name="checkbox"></form>`, standalone: false, }) class NgModelCheckboxRequiredValidator { accepted: boolean = false; required: boolean = false; } @Component({ selector: '...
{ "end_byte": 107684, "start_byte": 104642, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/template_integration_spec.ts" }
angular/packages/forms/test/form_builder_spec.ts_0_466
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {Component} from '@angular/core'; import {fakeAsync, TestBed, tick} from '@angular/core/testing'; import { F...
{ "end_byte": 466, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/form_builder_spec.ts" }
angular/packages/forms/test/form_builder_spec.ts_468_8864
(function () { function syncValidator() { return null; } function asyncValidator() { return Promise.resolve(null); } describe('Form Builder', () => { let b: FormBuilder; beforeEach(() => { b = new FormBuilder(); }); it('should create controls from a value', () => { const...
{ "end_byte": 8864, "start_byte": 468, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/form_builder_spec.ts" }
angular/packages/forms/test/form_builder_spec.ts_8870_14811
it('should create control arrays with multiple async validators', fakeAsync(() => { function asyncValidator1() { return of({'async1': true}); } function asyncValidator2() { return of({'async2': true}); } const a = b.array(['one', 'two'], null, [asyncValidator1, asyncValida...
{ "end_byte": 14811, "start_byte": 8870, "url": "https://github.com/angular/angular/blob/main/packages/forms/test/form_builder_spec.ts" }
angular/packages/forms/src/errors.ts_0_1180
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ /** * The list of error codes used in runtime code of the `forms` package. * Reserved error code range: 1000-1999....
{ "end_byte": 1180, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/errors.ts" }
angular/packages/forms/src/form_providers.ts_0_3134
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {ModuleWithProviders, NgModule} from '@angular/core'; import { InternalFormsSharedModule, NG_MODEL_WITH_...
{ "end_byte": 3134, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/form_providers.ts" }
angular/packages/forms/src/directives.ts_0_4285
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {NgModule, Type} from '@angular/core'; import {CheckboxControlValueAccessor} from './directives/checkbox_val...
{ "end_byte": 4285, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives.ts" }
angular/packages/forms/src/forms.ts_0_3881
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ /** * @module * @description * This module is used for handling user input, by defining and building a `FormGroup...
{ "end_byte": 3881, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/forms.ts" }
angular/packages/forms/src/validators.ts_0_5317
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import { InjectionToken, ɵisPromise as isPromise, ɵisSubscribable as isSubscribable, ɵRuntimeError as Runtim...
{ "end_byte": 5317, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/validators.ts" }
angular/packages/forms/src/validators.ts_5318_11893
ort class Validators { /** * @description * Validator that requires the control's value to be greater than or equal to the provided number. * * @usageNotes * * ### Validate against a minimum of 3 * * ```typescript * const control = new FormControl(2, Validators.min(3)); * * console.lo...
{ "end_byte": 11893, "start_byte": 5318, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/validators.ts" }
angular/packages/forms/src/validators.ts_11897_20402
* @description * Validator that requires the control's value to match a regex pattern. This validator is also * provided by default if you use the HTML5 `pattern` attribute. * * @usageNotes * * ### Validate that the field only contains letters or spaces * * ```typescript * const control =...
{ "end_byte": 20402, "start_byte": 11897, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/validators.ts" }
angular/packages/forms/src/validators.ts_20404_27538
ort function toObservable(value: any): Observable<any> { const obs = isPromise(value) ? from(value) : value; if ((typeof ngDevMode === 'undefined' || ngDevMode) && !isSubscribable(obs)) { let errorMessage = `Expected async validator to return Promise or Observable.`; // A synchronous validator will return o...
{ "end_byte": 27538, "start_byte": 20404, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/validators.ts" }
angular/packages/forms/src/util.ts_0_341
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ export function removeListItem<T>(list: T[], el: T): void { const index = list.indexOf(el); if (index > -1) list...
{ "end_byte": 341, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/util.ts" }
angular/packages/forms/src/form_builder.ts_0_5188
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {inject, Injectable} from '@angular/core'; import {AsyncValidatorFn, ValidatorFn} from './directives/validat...
{ "end_byte": 5188, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/form_builder.ts" }
angular/packages/forms/src/form_builder.ts_5189_13095
Injectable({providedIn: 'root'}) export class FormBuilder { private useNonNullable: boolean = false; /** * @description * Returns a FormBuilder in which automatically constructed `FormControl` elements * have `{nonNullable: true}` and are non-nullable. * * **Constructing non-nullable controls** *...
{ "end_byte": 13095, "start_byte": 5189, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/form_builder.ts" }
angular/packages/forms/src/form_builder.ts_13098_20058
trol<T>( formState: T | FormControlState<T>, validatorOrOpts?: ValidatorFn | ValidatorFn[] | FormControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null, ): FormControl { let newOptions: FormControlOptions = {}; if (!this.useNonNullable) { return new FormControl(...
{ "end_byte": 20058, "start_byte": 13098, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/form_builder.ts" }
angular/packages/forms/src/version.ts_0_416
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ /** * @module * @description * Entry point for all public APIs of the forms package. */ import {Version} from '...
{ "end_byte": 416, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/version.ts" }
angular/packages/forms/src/directives/reactive_errors.ts_0_5511
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {ɵRuntimeError as RuntimeError} from '@angular/core'; import {RuntimeErrorCode} from '../errors'; import { ...
{ "end_byte": 5511, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/reactive_errors.ts" }
angular/packages/forms/src/directives/ng_no_validate_directive.ts_0_827
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {Directive} from '@angular/core'; /** * @description * * Adds `novalidate` attribute to all forms by defa...
{ "end_byte": 827, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/ng_no_validate_directive.ts" }
angular/packages/forms/src/directives/ng_control_status.ts_0_3952
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {Directive, Optional, Self, ɵWritable as Writable} from '@angular/core'; import {AbstractControlDirective} f...
{ "end_byte": 3952, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/ng_control_status.ts" }
angular/packages/forms/src/directives/ng_control.ts_0_1184
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {AbstractControlDirective} from './abstract_control_directive'; import {ControlContainer} from './control_con...
{ "end_byte": 1184, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/ng_control.ts" }
angular/packages/forms/src/directives/select_multiple_control_value_accessor.ts_0_7983
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import { Directive, ElementRef, forwardRef, Host, Input, OnDestroy, Optional, Provider, Renderer2,...
{ "end_byte": 7983, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/select_multiple_control_value_accessor.ts" }
angular/packages/forms/src/directives/abstract_form_group_directive.ts_0_1866
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {Directive, OnDestroy, OnInit} from '@angular/core'; import {FormGroup} from '../model/form_group'; import ...
{ "end_byte": 1866, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/abstract_form_group_directive.ts" }
angular/packages/forms/src/directives/control_container.ts_0_952
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {AbstractControlDirective} from './abstract_control_directive'; import type {Form} from './form_interface'; ...
{ "end_byte": 952, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/control_container.ts" }
angular/packages/forms/src/directives/abstract_control_directive.ts_0_659
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {Observable} from 'rxjs'; import {AbstractControl} from '../model/abstract_model'; import {composeAsyncValid...
{ "end_byte": 659, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/abstract_control_directive.ts" }
angular/packages/forms/src/directives/abstract_control_directive.ts_660_9136
export abstract class AbstractControlDirective { /** * @description * A reference to the underlying control. * * @returns the control that backs this directive. Most properties fall through to that instance. */ abstract get control(): AbstractControl | null; /** * @description * Reports the ...
{ "end_byte": 9136, "start_byte": 660, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/abstract_control_directive.ts" }
angular/packages/forms/src/directives/abstract_control_directive.ts_9139_10387
hasError(errorCode: string, path?: Array<string | number> | string): boolean { return this.control ? this.control.hasError(errorCode, path) : false; } /** * @description * Reports error data for the control with the given path. * * @param errorCode The code of the error to check * @param path A ...
{ "end_byte": 10387, "start_byte": 9139, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/abstract_control_directive.ts" }
angular/packages/forms/src/directives/number_value_accessor.ts_0_2086
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {Directive, ElementRef, forwardRef, Provider} from '@angular/core'; import { BuiltInControlValueAccessor, ...
{ "end_byte": 2086, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/number_value_accessor.ts" }
angular/packages/forms/src/directives/shared.ts_0_8860
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {InjectionToken, ɵRuntimeError as RuntimeError} from '@angular/core'; import {RuntimeErrorCode} from '../err...
{ "end_byte": 8860, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/shared.ts" }
angular/packages/forms/src/directives/shared.ts_8861_17232
xport function cleanUpValidators( control: AbstractControl | null, dir: AbstractControlDirective, ): boolean { let isControlUpdated = false; if (control !== null) { if (dir.validator !== null) { const validators = getControlValidators(control); if (Array.isArray(validators) && validators.length ...
{ "end_byte": 17232, "start_byte": 8861, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/shared.ts" }
angular/packages/forms/src/directives/range_value_accessor.ts_0_1964
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {Directive, forwardRef, Provider} from '@angular/core'; import { BuiltInControlValueAccessor, ControlVal...
{ "end_byte": 1964, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/range_value_accessor.ts" }
angular/packages/forms/src/directives/form_interface.ts_0_2036
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {FormControl} from '../model/form_control'; import {FormGroup} from '../model/form_group'; import {AbstractF...
{ "end_byte": 2036, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/form_interface.ts" }
angular/packages/forms/src/directives/control_value_accessor.ts_0_6061
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {Directive, ElementRef, InjectionToken, Renderer2} from '@angular/core'; /** * @description * Defines an i...
{ "end_byte": 6061, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/control_value_accessor.ts" }
angular/packages/forms/src/directives/ng_form.ts_0_3946
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import { AfterViewInit, computed, Directive, EventEmitter, forwardRef, Inject, Input, Optional, Pr...
{ "end_byte": 3946, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/ng_form.ts" }
angular/packages/forms/src/directives/ng_form.ts_3947_10850
Directive({ selector: 'form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]', providers: [formDirectiveProvider], host: {'(submit)': 'onSubmit($event)', '(reset)': 'onReset()'}, outputs: ['ngSubmit'], exportAs: 'ngForm', standalone: false, }) export class NgForm extends ControlContainer implements Form, A...
{ "end_byte": 10850, "start_byte": 3947, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/ng_form.ts" }
angular/packages/forms/src/directives/template_driven_errors.ts_0_2310
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {ɵRuntimeError as RuntimeError} from '@angular/core'; import {RuntimeErrorCode} from '../errors'; import { ...
{ "end_byte": 2310, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/template_driven_errors.ts" }
angular/packages/forms/src/directives/ng_model_group.ts_0_2880
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import { Directive, forwardRef, Host, Inject, Input, OnDestroy, OnInit, Optional, Self, SkipSelf...
{ "end_byte": 2880, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/ng_model_group.ts" }
angular/packages/forms/src/directives/ng_model.ts_0_5808
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import { booleanAttribute, ChangeDetectorRef, Directive, EventEmitter, forwardRef, Host, Inject, Inp...
{ "end_byte": 5808, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/ng_model.ts" }
angular/packages/forms/src/directives/ng_model.ts_5809_13260
@Directive({ selector: '[ngModel]:not([formControlName]):not([formControl])', providers: [formControlBinding], exportAs: 'ngModel', standalone: false, }) export class NgModel extends NgControl implements OnChanges, OnDestroy { public override readonly control: FormControl = new FormControl(); // At runtime...
{ "end_byte": 13260, "start_byte": 5809, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/ng_model.ts" }
angular/packages/forms/src/directives/validators.ts_0_8214
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import { booleanAttribute, Directive, forwardRef, Input, OnChanges, Provider, SimpleChanges, } from '@...
{ "end_byte": 8214, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/validators.ts" }
angular/packages/forms/src/directives/validators.ts_8216_16449
/** * @description * An interface implemented by classes that perform asynchronous validation. * * @usageNotes * * ### Provide a custom async validator directive * * The following example implements the `AsyncValidator` interface to create an * async validator directive with a custom error key. * * ```typesc...
{ "end_byte": 16449, "start_byte": 8216, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/validators.ts" }
angular/packages/forms/src/directives/validators.ts_16451_19354
/** * A directive that adds maximum length validation to controls marked with the * `maxlength` attribute. The directive is provided with the `NG_VALIDATORS` multi-provider list. * * @see [Form Validation](guide/forms/form-validation) * * @usageNotes * * ### Adding a maximum length validator * * The following...
{ "end_byte": 19354, "start_byte": 16451, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/validators.ts" }
angular/packages/forms/src/directives/radio_control_value_accessor.ts_0_7807
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import { Directive, ElementRef, forwardRef, inject, Injectable, Injector, Input, OnDestroy, OnInit...
{ "end_byte": 7807, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/radio_control_value_accessor.ts" }
angular/packages/forms/src/directives/checkbox_value_accessor.ts_0_1599
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {Directive, forwardRef, Provider} from '@angular/core'; import { BuiltInControlValueAccessor, ControlVal...
{ "end_byte": 1599, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/checkbox_value_accessor.ts" }
angular/packages/forms/src/directives/default_value_accessor.ts_0_4144
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {ɵgetDOM as getDOM} from '@angular/common'; import { Directive, ElementRef, forwardRef, Inject, Inj...
{ "end_byte": 4144, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/default_value_accessor.ts" }
angular/packages/forms/src/directives/select_control_value_accessor.ts_0_6988
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import { Directive, ElementRef, forwardRef, Host, Input, OnDestroy, Optional, Provider, Renderer2,...
{ "end_byte": 6988, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/select_control_value_accessor.ts" }
angular/packages/forms/src/directives/error_examples.ts_0_1471
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ export const formControlNameExample = ` <div [formGroup]="myGroup"> <input formControlName="firstName"> </di...
{ "end_byte": 1471, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/error_examples.ts" }
angular/packages/forms/src/directives/reactive_directives/form_group_name.ts_0_7316
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import { Directive, forwardRef, Host, Inject, Input, OnDestroy, OnInit, Optional, Provider, Self...
{ "end_byte": 7316, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/reactive_directives/form_group_name.ts" }
angular/packages/forms/src/directives/reactive_directives/form_control_directive.ts_0_5905
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import { Directive, EventEmitter, forwardRef, Inject, InjectionToken, Input, OnChanges, OnDestroy, ...
{ "end_byte": 5905, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/reactive_directives/form_control_directive.ts" }
angular/packages/forms/src/directives/reactive_directives/form_control_name.ts_0_7138
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import { Directive, EventEmitter, forwardRef, Host, Inject, Input, OnChanges, OnDestroy, Optional,...
{ "end_byte": 7138, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/reactive_directives/form_control_name.ts" }
angular/packages/forms/src/directives/reactive_directives/form_group_directive.ts_0_2313
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import { computed, Directive, EventEmitter, forwardRef, Inject, Input, OnChanges, OnDestroy, Optio...
{ "end_byte": 2313, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/reactive_directives/form_group_directive.ts" }
angular/packages/forms/src/directives/reactive_directives/form_group_directive.ts_2314_10329
Directive({ selector: '[formGroup]', providers: [formDirectiveProvider], host: {'(submit)': 'onSubmit($event)', '(reset)': 'onReset()'}, exportAs: 'ngForm', standalone: false, }) export class FormGroupDirective extends ControlContainer implements Form, OnChanges, OnDestroy { /** * @description * Repor...
{ "end_byte": 10329, "start_byte": 2314, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/reactive_directives/form_group_directive.ts" }
angular/packages/forms/src/directives/reactive_directives/form_group_directive.ts_10332_12932
updateDomValue() { this.directives.forEach((dir) => { const oldCtrl = dir.control; const newCtrl = this.form.get(dir.path); if (oldCtrl !== newCtrl) { // Note: the value of the `dir.control` may not be defined, for example when it's a first // `FormControl` that is added to a `Form...
{ "end_byte": 12932, "start_byte": 10332, "url": "https://github.com/angular/angular/blob/main/packages/forms/src/directives/reactive_directives/form_group_directive.ts" }