Angular Modernizer
    Preparing search index...

    Inspects Reactive Forms defined in a source file.

    Reports the controls a class builds (paths, kinds, validators, initially disabled), and every place in the file that changes a control's state (enable, disable, validator changes, addControl, optionally value changes), mapped back to the control path it targets.

    Forms are recognised from FormBuilder calls (fb.group, fb.nonNullable.group, fb.control, fb.array, fb.record) and new FormGroup/FormControl/FormArray/FormRecord (and the Untyped* variants), assigned to a class property (initializer or this.x = ...). Receivers are resolved through controls.a, controls['a'], get('a.b'), get(['a', 'b']), chained get(), local variables and single-return getters. enable()/disable() on a group cascades to every descendant; each control lists those as cascade. Only the class's own source file is searched; code that receives the form as a parameter elsewhere is not seen.

    const [form] = new FormGroupInspector(project).inspect('/src/app/edit.component.ts');
    // form.controls.find((c) => c.path === 'extended.orderNumber')
    // -> { validators: ['Validators.required', 'Validators.maxLength(50)'], operations: [{ op: 'enable', line: 308 }, ...],
    // cascade: [{ op: 'enable', from: 'extended', line: 331 }] }
    Index

    Constructors

    Methods

    Constructors

    Methods

    • Inspects the forms of every class in a file (or one class).

      Parameters

      • file: string

        Absolute path of the .ts file declaring the class.

      • options: FormGroupInspectorOptions = {}

        Class, property and value-operation filters.

      Returns InspectedForm[]

      One entry per form property, in declaration order; empty when the file is not in the project.