api

Description

This property helps to get the list of options for the select field from the http. This property only acceptable when the getListFromApi 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: {}
    }
}];

Last updated