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
  • Description
  • Example

Was this helpful?

  1. Apis

setControlEnable

Description

  • enable the formcontrol

  • parameters

    • formControlName

Example

import { NgMatFormOptions, NgMatFormFields, NgMatFormService } 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...
    }];
    
    setDisable(): void {
        //this.ngMatFormService.setControlEnable(formControlName);
        this.ngMatFormService.setControlEnable('name');
    }

    constructor(private ngMatFormService:NgMatFormService) {}
}
PrevioussetControlDisableNextsetValidator

Last updated 5 years ago

Was this helpful?