Skip to content
Snippets Groups Projects
compound-element.directive.ts 689 B
Newer Older
  • Learn to ignore specific revisions
  • import {
      AfterViewInit,
      Directive, EventEmitter, Output, QueryList
    } from '@angular/core';
    import { FormGroup } from '@angular/forms';
    import { ElementComponent } from '../../element-component.directive';
    import { InputElement } from '../../models/uI-element';
    
    @Directive({ selector: 'app-compound-element' })
    
    export abstract class CompoundElementComponent implements AfterViewInit {
      @Output() childrenAdded = new EventEmitter<QueryList<ElementComponent>>();
      compoundChildren!: QueryList<ElementComponent>;
      parentForm!: FormGroup;
    
      ngAfterViewInit(): void {
        this.childrenAdded.emit(this.compoundChildren);
      }
    
      abstract getFormElementModelChildren(): InputElement[];
    }