Skip to content

Bind Input [Group] validity directly to ngModel so it responds better to changes through API #6434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
damyanpetev opened this issue Jan 9, 2020 · 16 comments
Assignees

Comments

@damyanpetev
Copy link
Member

Preface: The visual validity of a control (as displayed to the user) is a combination of the status and usually either dirty or touched, per Form Validation.

Is your request related to a problem? Please describe.

Updating FormControl properties such as touched/dirty through API (like you might to trigger manual form validation) won't reflect in the Input and Group state, despite causing other validation messages to be displayed.

Currently the validity of the igxInput (and thus the Input Group) is updated based on the AbstractControl.statusChanges. And blur. And focus.

if (this.ngControl) {
this._statusChanges$ = this.ngControl.statusChanges.subscribe(this.onStatusChanged.bind(this));
}

However, this doesn't quite cover the condition for validity and there are no other events for changes in touched/dirty control state.

Describe alternatives you've considered

An additional call to updateValueAndValidity to ensure the event is emitted and the Input updates: #4756 (comment).

Describe the solution you'd like

While that's not a major issue, it'd be better if we do away with the subscription and directly bind the input validity and group styling to the ngModel properties.

Additional context

Because the initial value bind already determined the status, the ngModel control starts out as pristine and invalid and so igxInput.valid is IgxInputState.INITIAL.
At this point calling markAsTouched() or markAsDirty() technically completes the requirement for a visual error (and error messages do appear), but there's no statusChanges so the input state and group styling remain initial.

@github-actions
Copy link

There has been no recent activity and this issue has been marked inactive.

@github-actions github-actions bot added the status: inactive Used to stale issues and pull requests label May 10, 2020
@Lipata Lipata removed the status: inactive Used to stale issues and pull requests label May 18, 2020
@Lipata Lipata reopened this May 18, 2020
@github-actions
Copy link

There has been no recent activity and this issue has been marked inactive.

@github-actions github-actions bot added the status: inactive Used to stale issues and pull requests label Jul 18, 2020
@Lipata Lipata removed the status: inactive Used to stale issues and pull requests label Jul 19, 2020
@github-actions
Copy link

There has been no recent activity and this issue has been marked inactive.

@github-actions github-actions bot added the status: inactive Used to stale issues and pull requests label Sep 18, 2020
@Lipata Lipata removed the status: inactive Used to stale issues and pull requests label Sep 18, 2020
@github-actions
Copy link

There has been no recent activity and this issue has been marked inactive.

@github-actions github-actions bot added the status: inactive Used to stale issues and pull requests label Nov 18, 2020
@Lipata Lipata removed the status: inactive Used to stale issues and pull requests label Nov 18, 2020
@github-actions
Copy link

There has been no recent activity and this issue has been marked inactive.

@github-actions github-actions bot added the status: inactive Used to stale issues and pull requests label Jan 18, 2021
@Lipata Lipata removed the status: inactive Used to stale issues and pull requests label Jan 18, 2021
@github-actions
Copy link

There has been no recent activity and this issue has been marked inactive.

@github-actions github-actions bot added the status: inactive Used to stale issues and pull requests label Mar 20, 2021
@Lipata Lipata removed the status: inactive Used to stale issues and pull requests label Mar 22, 2021
@github-actions
Copy link

There has been no recent activity and this issue has been marked inactive.

@github-actions github-actions bot added the status: inactive Used to stale issues and pull requests label May 22, 2021
@Lipata Lipata removed the status: inactive Used to stale issues and pull requests label May 25, 2021
@github-actions
Copy link

There has been no recent activity and this issue has been marked inactive.

@github-actions github-actions bot added the status: inactive Used to stale issues and pull requests label Jul 25, 2021
@Lipata Lipata removed the status: inactive Used to stale issues and pull requests label Jul 26, 2021
@github-actions
Copy link

There has been no recent activity and this issue has been marked inactive.

@github-actions github-actions bot added the status: inactive Used to stale issues and pull requests label Sep 25, 2021
@Lipata Lipata removed the status: inactive Used to stale issues and pull requests label Sep 27, 2021
@github-actions
Copy link

There has been no recent activity and this issue has been marked inactive.

@github-actions github-actions bot added the status: inactive Used to stale issues and pull requests label Nov 27, 2021
@Lipata Lipata removed the status: inactive Used to stale issues and pull requests label Nov 27, 2021
@github-actions
Copy link

There has been no recent activity and this issue has been marked inactive.

@github-actions github-actions bot added the status: inactive Used to stale issues and pull requests label Jan 27, 2022
@Lipata Lipata removed the status: inactive Used to stale issues and pull requests label Jan 27, 2022
@github-actions
Copy link

There has been no recent activity and this issue has been marked inactive.

@github-actions github-actions bot added the status: inactive Used to stale issues and pull requests label Mar 29, 2022
@Lipata Lipata removed the status: inactive Used to stale issues and pull requests label Mar 29, 2022
@github-actions
Copy link

There has been no recent activity and this issue has been marked inactive.

@github-actions github-actions bot added the status: inactive Used to stale issues and pull requests label May 29, 2022
@Lipata Lipata removed the status: inactive Used to stale issues and pull requests label May 29, 2022
@github-actions
Copy link

There has been no recent activity and this issue has been marked inactive.

@github-actions github-actions bot added the status: inactive Used to stale issues and pull requests label Jul 29, 2022
@Lipata Lipata removed the status: inactive Used to stale issues and pull requests label Jul 29, 2022
@github-actions
Copy link

There has been no recent activity and this issue has been marked inactive.

@github-actions github-actions bot added the status: inactive Used to stale issues and pull requests label Sep 28, 2022
@Lipata Lipata removed the status: inactive Used to stale issues and pull requests label Sep 28, 2022
@github-actions
Copy link

There has been no recent activity and this issue has been marked inactive.

@github-actions github-actions bot added the status: inactive Used to stale issues and pull requests label Nov 28, 2022
@github-actions github-actions bot closed this as completed Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants