Useful or not, from you.
angular Getting "control.registerOnChange is not a function" after changing form

I'm submitting a ... (check one with "x")

[ x ] bug report => search github for a similar issue or PR before submitting
[   ] feature request
[   ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior <!-- Describe how the bug manifests. --> After patching a form of type FormArray (form.patchValue(myArray);) with FormGroup items, [formGroup]='form' in my html throws control.registerOnChange is not a function. I patch it when I initialize my app and everything works fine but when I change the form with another FormArray (I tried with the same array), I'm getting this error. After further investigation (and hours trying to understand what was going on), it seems that the error comes from line 1634 of forms.umd.js when it does control.registerOnChange(function (newValue, emitModelEvent) {.

When it works, control (of control.registerOnChange) is of form FormControl while when it fails, it is of form FormGroup. The problem is that my FormArray is somewhat deep and the first time I patch it, it goes at the leaf of the branches to reach FormControl while the second time it goes to the first branch which in my case is a FormGroup.

The problem is that I don't know why it doesn't go to the leaf the second time. I use the same functions and methodology to patch the values and the FormArray looks exactly the same in both cases!

Expected behavior <!-- Describe what the behavior would be without the bug. --> It should not throw any error...

Minimal reproduction of the problem with instructions <!-- If the current behavior is a bug or you can illustrate your feature request better with an example, please provide the STEPS TO REPRODUCE and if possible a MINIMAL DEMO of the problem via https://plnkr.co or similar (you can use this template as a starting point: http://plnkr.co/edit/tpl:AvJOMERrnz94ekVua0u5). --> I couldn't make a minimal demo but would definitely share the functions I use to create the form if needed.

What is the motivation / use case for changing the behavior? <!-- Describe the motivation or the concrete use case -->

Please tell us about your environment: <!-- Operating system, IDE, package manager, HTTP server, ... --> NodeJS 7.4.0 running on Windows 10

  • Angular version: 2.4.7

  • Browser: Chrome 55 64bit

  • Language: Typescript

That's a useful answer
Without any help

Almost 3 years and not a word from the Angular team!

It is a shame that the Angular community spends time to find bugs and work on solutions but the team doesn't pay attention to that! What should I do to get it fixed in the next release?

I am currently working on a new project and have moved to React... I love Angular but if we can't get the support we need after 3 years, it makes it unusable!