angular icon indicating copy to clipboard operation
angular copied to clipboard

[Question] Builder Initialized Output Event

Open Vedhachala opened this issue 6 years ago • 1 comments

Hi Formio team, I need the builder instance once the builder is initialized. This is similar to the (ready) event available for selector. The change output event does not address our use case. I am expecting something like this: <form-builder [form]="formJSON" (ready)="builderLoaded($event)"></form-builder>

So is there any plan to introduce this or any workaround to achieve this.?

Vedhachala avatar Jul 27 '20 12:07 Vedhachala

You can get it like this.

import { Component, AfterViewInit, ViewChild } from '@angular/core';
import { FormBuilderComponent } from 'angular-formio';

@Component({
  template: '<form-builder></form-builder>'
})
export class FormRenderComponent implements AfterViewInit {
  @ViewChild(FormBuilderComponent, true) formBuilder: FormBuilderComponent;
  ngAfterViewInit() {
    this.formBuilder.ready.then((builder) => {
      // "builder" is the form builder instance.
      console.log(builder);
    });
  }
}

travist avatar Jul 27 '20 14:07 travist