mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
As previously discussed in pull/31070 and issues/30486, this would be useful because it is often desirable to apply styles to fields that are both `ng-invalid` and `ng-pristine` after the first attempt at form submission, but Angular does not provide any simple way to do this (although evidently Angularjs did). This will now be possible with a descendant selector such as `.ng-submitted .ng-invalid`.
In this implementation, the directive that sets control status classes on forms and formGroups has its set of statuses widened to include `ng-submitted`. Then, in the event that `is('submitted')` is invoked, the `submitted` property of the control container is returned iff it exists. This is preferred over checking whether the container is a `Form` or `FormGroup` directly to avoid reflecting on those classes.
Closes #30486.
PR Close #42132.
This reverts commit
|
||
|---|---|---|
| .. | ||
| reactive_directives | ||
| abstract_control_directive.ts | ||
| abstract_form_group_directive.ts | ||
| checkbox_value_accessor.ts | ||
| control_container.ts | ||
| control_value_accessor.ts | ||
| default_value_accessor.ts | ||
| error_examples.ts | ||
| form_interface.ts | ||
| ng_control.ts | ||
| ng_control_status.ts | ||
| ng_form.ts | ||
| ng_model.ts | ||
| ng_model_group.ts | ||
| ng_no_validate_directive.ts | ||
| number_value_accessor.ts | ||
| radio_control_value_accessor.ts | ||
| range_value_accessor.ts | ||
| reactive_errors.ts | ||
| select_control_value_accessor.ts | ||
| select_multiple_control_value_accessor.ts | ||
| shared.ts | ||
| template_driven_errors.ts | ||
| validators.ts | ||