YU-LEE-SIN / angular-material

JSON powered forms for Angular Material

Home Page:https://form.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dynamic JSON Powered forms for Angular Material

This library introduces the powerful Form.io JSON forms into the Angular Material framework.

Installation

To install this library into your application, you will need to run the following.

npm install formiojs @formio/angular @formio/angular-material

Then, you will need to add the following to your codebase.

src/app/app.module.ts

import { MatFormioModule } from '@formio/angular-material';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    MatFormioModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Using this library

This library can be used to render dynamic JSON powered forms within any Angular Material application. This uses the exact same syntax as the <formio> component within the Angular Form.io Library. The only difference is that you will use the <mat-formio> directive instead.

For example, the following will render a dynamic JSON form within your application.

<mat-formio src="https://examples.form.io/kitchensink"></mat-formio>

You can also use this to render JSON forms as follows.

<mat-formio [form]="{
  components: [
    {
      type: 'textfield',
      label: 'First Name',
      key: 'firstName'
    },
    {
      type: 'textfield',
      label: 'Last Name',
      key: 'lastName'
    },
    {
      type: 'button',
      action: 'submit',
      label: 'Submit',
      key: 'submit'
    }
  ]
}" (submit)="onSubmit($event)"></mat-formio>

About

JSON powered forms for Angular Material

https://form.io

License:MIT License


Languages

Language:TypeScript 92.6%Language:HTML 4.5%Language:CSS 1.9%Language:JavaScript 0.9%