使用Angular 2 MongoDB和WebAPI的动态表单

时间:2018-01-30 10:24:21

标签: mongodb angular angular-reactive-forms

这不仅仅是动态反应表格。

用法

我想基于数据库中的值在表单中动态生成控件。控件可以从Dropdown,TextArea,Input等变化,控件的类型在数据库中指定,并将得到像这样的json

{
    "Controls": [{
            "controlid": "24",
            "controltype": "textarea",
            "controlname": "textarea24",
            "validations": {
                "Required": "true",
                "MaxLength": "100",
                "MinLength": "2"
            }
        },
        {
            "controlid": "25",
            "controltype": "select",
            "controlname": "select25",
            "validations": {
                "Required": "false",
                "MaxLength": "0",
                "MinLength": "0"
            }
        },
        {
            "controlid": "26",
            "controltype": "radio",
            "controlname": "radio26",
            "validations": {
                "Required": "true",
                "MaxLength": "0",
                "MinLength": "0"
            }
        }
    ]
}

我如何使用Angular 4实现这一点,并且还想提交生成的表单。

0 个答案:

没有答案