Skip to content

Instantly share code, notes, and snippets.

@travist
Last active March 31, 2023 16:31
Show Gist options
  • Save travist/e639060968a6ec984b38a49c3753043f to your computer and use it in GitHub Desktop.
Save travist/e639060968a6ec984b38a49c3753043f to your computer and use it in GitHub Desktop.
import { Component, AfterViewInit, ViewChild } from '@angular/core';
import { FormioComponent, Formio } from '@formio/angular';
@Component({
template: `
<formio src="https://examples.form.io/example"></formio>
<button (click)="submitFormio()" class="btn btn-primary">Submit</button>
`
})
export class FormRenderComponent implements AfterViewInit {
public formio: Formio;
@ViewChild(FormioComponent) formioComponent: FormioComponent;
ngAfterViewInit() {
this.formioComponent.formioReady.then((formio) => {
this.formio = formio;
});
}
submitFormio() {
this.formio.submit().then(() => {
this.route.navigate(['...']);
}):
}
}
@andreishitikov
Copy link

andreishitikov commented Feb 15, 2022

this.formioComponent.ready is not promise there

@travist
Copy link
Author

travist commented Feb 15, 2022

I think it needs to be formioReady. I have updated the example. Will you let me know if this works for you now?

@andreishitikov
Copy link

it works now, maybe you know how to catch submersion of internal form via this construction?

@andreishitikov
Copy link

@travist do we have formio.on(...) function here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment