小编mel*_*ina的帖子

表单构建器角度2 - 如何构造控件数组?

我正在尝试创建一个表单生成器,从中生成一个特定的JSON格式体,将其放在服务器上,我遇到的问题是如何表示我的代码中指示的任务数组,这里是我的格式构建器:

    this.form = fb.group({          
               Action: fb.group({
                label: [],
                actionType: [],
                description: [],
                HTTPMethod: [],
                ressourcePattern: [],
                status: [],
                parameters: [],
                linkedprocess: fb.group({
                process: fb.group({
                    label: []
                }),
                /////////////////////
                associatedTasks:[],     // => here i want to represent the associated tasks
                    task: fb.group({   // it's an array of task 
                        label:[]
                    })
                /////////////////////
               }),
                labelParam: [],
                descriptionParam: []
               })
            });
Run Code Online (Sandbox Code Playgroud)

这是我想从我的表单中获取的json格式:

    {"Action":       {
             "label": "A7791",
             "HTTPMethod": "POST",
             "actionType": "indexation",
             "status": "active",
             "description": "descroption new",
             "resourcePattern": "",
             "creationDate": "30-05-2016 06:14:09",
             "modificationDate": "13-06-2016 11:51:10",
             "parameters": …
Run Code Online (Sandbox Code Playgroud)

json angular2-forms angular2-formbuilder angular

6
推荐指数
1
解决办法
8233
查看次数