import { ChangeDetectorRef } from '@angular/core'; import { FieldType } from '@ngx-formly/core'; export abstract class AbstractSamFormly extends FieldType { public cdr: ChangeDetectorRef; public template: any; public ngDoCheck () { this.setProperties( this.template, (this).field.templateOptions ); } public setProperties (component: any, configuration: any) { Object.keys(configuration).forEach( key => { component[key] = configuration[key]; } ); if ((this).template.control) { (this).template.control = (this).formControl; } this.cdr.detectChanges(); } }