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
  • Hint:
  • Example

Was this helpful?

  1. Attributes
  2. Fields

api

PreviousgetListFromApiNextloadDepenentSelectOnChange

Last updated 5 years ago

Was this helpful?

Description

This property helps to get the list of options for the select field from the http. This property only acceptable when the flag it true.

Hint:

  • Type: NgMatSelectListFromUrl

  • Property of NgMatFormField

Example

Fields: NgMatFormFields[] = [{
    type: 'select',
    label: 'Password',
    placeholder: 'Enter a Password',
    formControlName: 'password',
    list: [],
    getListFromApi: true,
    api: {
        // Header for the service
        header: new HttpHeaders().set('Access-Control-Allow-Origin', '*'),
        // Service url
        url: 'https://my-json-server.typicode.com/msk-satheesh-5599/Portfolio/db',
        // method of the service
        method: 'get',
        //parameters to be passed to the service
        params: {}
    }
}];
getListFromApi