Skip to content

Instantly share code, notes, and snippets.

@travist
Created August 22, 2017 01:21
Show Gist options
  • Select an option

  • Save travist/79d4d415e6b85fae13a73e7e23f0566b to your computer and use it in GitHub Desktop.

Select an option

Save travist/79d4d415e6b85fae13a73e7e23f0566b to your computer and use it in GitHub Desktop.
Send form submission to custom API
import { Component } from '@angular/core';
import { FormioService } from 'ng2-formio';
@Component({
template: '<formio *ngIf="form" form="[form]" (submit)="onSubmit($event)"></formio>'
})
export class FormioFormExample {
public form: object;
public service: FormioService;
constructor() {
this.service = new FormioService('https://examples.form.io/example');
this.service.loadForm().subscribe((form: object) => {
this.form = form;
});
}
onSubmit(submission:object) {
// Send the submission to your own api here...
console.log(submission);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment