You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
When you have multiple input fields with the same name, like radio buttons for example, you are getting one ngModel controller for each input. But, when you addressing this field by name, like this: formName.fieldName, you are getting a reference to the last ngModel controller.
The problem is that this controllers doesn't know about each other and do not coordinate their state. And from the user perspective they must have a shared state.
In the provided example, I'm trying to detect pristine state of the gender radio field, but I'm getting incorrect result, since I'm getting pristine state not of the entire radio group but only of the last radio button in the group.
From the end-user perspective this can be considered a real bug.
As a solution to this problem, maybe we should use a single ngModel controller for all inputs with the same name, or probably better, to synchronize the state of ngModels from the same group, so properties like $pristine would be consistent.