删除嵌套表单组中的对象

时间:2019-10-15 05:54:40

标签: angular angular6 angular-reactive-forms

我正在从事角向反应形式项目。我需要删除嵌套表单组中的对象

this.surveyForm = this.fb.group({
      name: [null],
      _id: [null],
      question: [null],
      from_list: [true],
      type: CampaignActivityType.Survey,
      questionList:this.fb.group({
      question: ['', Validators.required],
      answers:this.fb.group({
      answer: ['', Validators.required]
    });
    });
)
    });

我需要删除特定索引中的答案对象

1 个答案:

答案 0 :(得分:0)

尝试一下:

df = df.iloc[:, [0]].join(df1)
df['Parameters'] += np.select([df.index.duplicated(keep='last'), 
                               df.index.duplicated()], 
                               ['_P','_Q'], 
                               default='')

df = df.reset_index(drop=True)
print (df)

  Parameters  A  B   C
0      Apple  1  2   3
1     Banana  2  4   5
2     Potato  3  5   2
3   Tomato_P  1  1   2
4   Tomato_Q  4  6   1