Angular - valueChanges for form array

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
        ])
    });

If I want "valueChanges" for step1.transporter_id only then this observable works fine

this.editForm.controls.step1.get('flight_code').valueChanges.subscribe(data => {});

What is the syntax if I want to "see" "stop: this.fb.array".

Examples that do not work

this.editForm.controls.stops.get().valueChanges.subscribe(data => {});
this.editForm.controls.stops.get('stops').valueChanges.subscribe(data => {});
this.editForm.get('stops').valueChanges.subscribe(data => {});
+4
source share

Source: https://habr.com/ru/post/1679261/


All Articles