All files / src/lib/dynamic-form-input/dynamic-form-file dynamic-form-file.component.ts

100% Statements 7/7
100% Branches 0/0
100% Functions 2/2
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38                                  1x               1x 1x   1x       1x 1x 1x      
import { Component, OnInit, ViewChild } from '@angular/core';
import { NgControl, ReactiveFormsModule } from '@angular/forms';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInput, MatInputModule } from '@angular/material/input';
import {
  DynamicFormBuilder,
  DynamicFormElementComponent,
  DynamicFormFileBase,
  DynamicFormFileDirective,
  DynamicFormValidationService,
} from '@dynamic-forms/core';
 
@Component({
  selector: 'mat-dynamic-form-file',
  templateUrl: './dynamic-form-file.component.html',
  imports: [ReactiveFormsModule, DynamicFormFileDirective, DynamicFormElementComponent, MatInputModule, MatFormFieldModule],
})
export class MatDynamicFormFileComponent extends DynamicFormFileBase implements OnInit {
  @ViewChild(MatInput, { static: true })
  protected _matInput: MatInput;
 
  @ViewChild(NgControl, { static: true })
  protected _ngControl: NgControl;
 
  constructor(
    protected override builder: DynamicFormBuilder,
    protected override validationService: DynamicFormValidationService,
  ) {
    super(builder, validationService);
  }
 
  override ngOnInit(): void {
    super.ngOnInit();
    this._matInput.ngControl = this._ngControl;
    this._matInput['_errorStateTracker'].ngControl = this._ngControl;
  }
}