ng-mat-forms
  • Introduction
  • Installing
  • Getting Started
  • Attributes
    • Options
      • column
      • errorMsgOnSubmit
      • floatLabel
      • color
      • appearance
    • Fields
      • type
      • label
      • formControlName
      • directive
      • placeholder
      • regex
      • defaultValue
      • validators
      • list
      • disable
      • labelShow
      • minDate
      • maxDate
      • changeEvents
      • blurEvents
      • maxLength
      • minLength
      • getListFromApi
      • api
      • loadDepenentSelectOnChange
      • errorMessage
  • Callbacks
    • formFieldsChange
    • formChange
    • formSubmit
  • Apis
    • setControlValue
    • setFormValue
    • setControlDisable
    • setControlEnable
    • setValidator
    • removeValidator
Powered by GitBook
On this page

Was this helpful?

Getting Started

To use ng-mat-forms define the application class as follows:

import {NgMatFormOptions,NgMatFormFields} from 'ng-mat-forms';
// other imports here...

export class MyTestApp {

    public ngMatFormsOptions: NgMatFormOptions = {
        column: 3
        // other options...
    };

    // Initialized a field list array which extended a field interface.
    public ngMatFormFields: NgMatFormFields[] = [{
        type: 'input',
        label: 'User Name',
        placeholder: 'Enter a User Name',
        formControlName: 'name'
        // other options...
    }, {
        type: 'select',
        label: 'Password',
        placeholder: 'Enter a Password',
        formControlName: 'password',
        list: [
            {
                name: 'Infinity War',
                value: 'Avengers',
                type: 'option'
            },
            {
                name: 'End Game',
                value: 'Avengers',
                type: 'option'
            }
        ]
        // other options...
    }];

    constructor() { }
}  
<ng-mat-forms [Fields]='ngMatFormFields' 
[options]='ngMatFormsOptions'></ng-mat-forms>

and you're ready to use.

PreviousInstallingNextAttributes

Last updated 5 years ago

Was this helpful?