2017-10-19 106 views
0
this.parentForm = this._fb.group({ 
    testControl1: [], 
    testControl2: [], 
    testChildForm1: this._fb.group({ 
     testChildControl1: [], 
     testChildControl2: [] 
    }) 
    )}; 

對於上述父窗體,它包含兩個窗體控件和一個嵌套子窗體組。在角反應形式可以添加一個嵌套的形式沒有數組?

我想訪問子窗體的值如下面

this.parentForm.controls [「testChildForm1」]。controls.testChildControl1

但不能因爲TS發出訪問子窗體的控制一個錯誤住宅「控制」上不存在型「AbstractControl」

回答

0

怎麼是這樣的:

this.parentForm.get(`testChildForm1.testChildControl1`).value