如何在Angular 4+中获取FormControl的完整路径?
我有一个响应式表单:
{
name: '',
address: {
city: '',
country: ''
}
}
我真的需要获取控件的完整路径:
const addressFormGroup = this.form.get('address');
const cityControl = addressFormGroup.get('city');
cityControl.plsGiveMeFullPath() //address.city
有没有现成的方法可以获取 cityControl: FormControl | FormGroup 的完整路径?
formGroup[name]
给我一个错误:Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ [key: string]: AbstractControl; } | AbstractControl[]'. No index signature with a parameter of type 'string' was found on type '{ [key: string]: AbstractControl; } | AbstractControl[]'
. 有什么办法可以修复它吗? - lonix