反应式表单数组未将对象添加到具有属性的表单组

问题描述

我正在做 Angular 项目,这种形式是使用反应式形式生成的。

现在,我认在表单上添加一个字段。这是添加数据的代码

Array ( [Table] => products [Create Table] => CREATE TABLE `products` ( `product_id` int(11) NOT NULL AUTO_INCREMENT,`product_name` varchar(255) NOT NULL,`product_brand` varchar(255) NOT NULL,`product_eval_status` tinyint(1) DEFAULT NULL,`product_eval_date` date DEFAULT NULL,`product_note` text,`company_id` int(11) NOT NULL,`user_id` int(11) DEFAULT NULL,`facility_id` int(11) DEFAULT NULL,`pl_id` int(11) DEFAULT NULL,PRIMARY KEY (`product_id`),KEY `company_id` (`company_id`) USING BTREE,KEY `user_id` (`user_id`) USING BTREE,KEY `facility_id` (`facility_id`) USING BTREE,KEY `pl_id` (`pl_id`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=latin1 ) 

最初插入数据的方法被称为它只添加

 this.objectFields.push(this._formBuilder.group({
        fieldLabel: [{ value: 'name',disabled: true },Validators.required],fieldType: [{value: 'text',disabled: true},fieldName: [{ value: 'name',disabled: true }],dataSet: [],required: [{ value: true,displayInGrid: [{ value: true,disabled: true }]
      }));

剩余字段未添加到表单组中。

如果我将其添加为:

dataSet: null

HTML 代码

 this.objectFields.push(this._formBuilder.group({
            fieldLabel: ['name',fieldType: ['text',fieldName: ['name'],required: [true],displayInGrid: [true]
          }));

即没有价值对象和禁用属性,那么它工作正常。

为什么表单组没有添加带值的对象和禁用的对象?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)