import {AfterViewInit, Component, OnInit, Pipe, PipeTransform, ViewEncapsulation} from '@angular/core'; import {FieldType} from '@ngx-formly/material'; @Component({ selector: 'jhi-mandatory-field', templateUrl: './mandatory-field.component.html', styleUrls: ['./mandatory-field.component.scss'], encapsulation: ViewEncapsulation.None }) export class MandatoryFieldComponent extends FieldType implements OnInit, AfterViewInit { checkboxOptions: any[] = []; valueSetted = ''; constructor() { super(); } ngOnInit(): void { } ngAfterViewInit() { super.ngAfterViewInit(); const property = 'variable'; const variableName = this.field[property]; if (this.model[variableName]) { this.field.formControl.setValue(true); } else { this.field.formControl.setValue(false); } } }