this.editForm = this.fb.group({
step1: this.fb.group({
transport_type_id: ['', [Validators.required]],
flight_code: ['', []],
}),
stops: this.fb.array([
this.initStop() //adds dynamicaly the fields, but I want to watch the whole array
])
});
如果我只想为 step1.transporter_id “valueChanges”,那么这个 observable 工作正常
this.editForm.controls.step1.get('flight_code').valueChanges.subscribe(data => {});
如果我想“观看”“停止:this.fb.array”,语法是什么。
无效的例子
this.editForm.controls.stops.get().valueChanges.subscribe(data => {});
this.editForm.controls.stops.get('stops').valueChanges.subscribe(data => {});
this.editForm.get('stops').valueChanges.subscribe(data => {});