File

angular/projects/researchdatabox/form/src/app/form-field-wrapper.component.ts

Description

Form Field Wrapper component

Author: Shilo Banihit

Implements

OnInit

Metadata

Index

Properties
Methods
Inputs

Inputs

compInfo
Type : any
Default value : null as any
data
Type : any

Methods

loadComponent
loadComponent()
Returns : void
ngOnInit
ngOnInit()
Returns : void

Properties

formFieldDirective
Type : FormFieldWrapperDirective
Decorators :
@ViewChild(FormFieldWrapperDirective, {static: true})
import { Component, Input, OnInit, ViewChild } from '@angular/core';
import { FormFieldWrapperDirective } from './form-field-wrapper.directive';
import { FormBaseComponent } from '@researchdatabox/portal-ng-common';
/**
 * Form Field Wrapper component
 *
 * Author: <a href='https://github.com/shilob' target='_blank'>Shilo Banihit</a>
 *
 */
@Component({
  selector: 'redbox-form-field',
  template: `
    <ng-template formFieldComp></ng-template>
  `,
})
export class FormFieldWrapperComponent implements OnInit {
  @Input() compInfo: any = null as any;
  @Input() data: any;
  
  @ViewChild(FormFieldWrapperDirective, {static: true}) formFieldDirective!: FormFieldWrapperDirective;

  ngOnInit() {
    this.loadComponent();
  }

  loadComponent() {
    const viewContainerRef = this.formFieldDirective.viewContainerRef;
    viewContainerRef.clear();

    const componentRef = viewContainerRef.createComponent<FormBaseComponent>(this.compInfo);
    // componentRef.instance.data = this.data;
  }

  

}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""