Skip to content
This repository was archived by the owner on Apr 30, 2018. It is now read-only.
This repository was archived by the owner on Apr 30, 2018. It is now read-only.

A way to preload options in select from http but not using javascript functions directly in JSON #758

Open
@falinsin

Description

@falinsin

If I load this field from query to the server (examples: REST, AJAX, HTTP)

    [{
        "key": "countries",
        "type": "select",
        "className": "col-xs-6",
        "templateOptions": {
            "label": "Countries",
            "options": [
                {"name": "UK", "id":1},
                {"name": "France", "id":2},
                {"name": "Japan", "id":3}
            ],
            "valueProp": "id",
            "labelProp": "name",
            "required":true
        }
    }]

This JSON is loaded from server like a txt string and I do not want to use functions in options, only a name of a service predefined inside angular which will load the data (key-value format).

I do not know if it is possible that after resolving the promise of the load in the service the list is reflected in the options of the select.

Do you think it is better to create a new type of customize select?
And within the definition of the new type create a controller where receive the data of the default resource from where load the data.
Even it could be a simple URL wi can fill in templateOptions to make it more general and use in the controller for get the data for the options and refresh the select.

Is there an example of this?

Thanks to all the team for your brilliant work with angular-formly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions