Skip to content

Conversation

@crisbeto
Copy link
Member

Similar to #23362. Fixes that the required asterisk wasn't being shown when a select is required.

@crisbeto crisbeto added P2 The issue is important to a large percentage of users, with a workaround target: major This PR is targeted for the next major release labels Aug 31, 2021
@crisbeto crisbeto added this to the 13.0.0 milestone Aug 31, 2021
@crisbeto crisbeto requested a review from jelbourn August 31, 2021 19:41
@google-cla google-cla bot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Aug 31, 2021
…dator

Similar to angular#23362. Fixes that the required asterisk wasn't being shown when a select is required.
@crisbeto crisbeto force-pushed the select-required-asterisk branch from b2671d1 to 5df0079 Compare August 31, 2021 19:58
@Input()
get required(): boolean { return this._required; }
get required(): boolean {
return this._required ?? this.ngControl?.control?.hasValidator(Validators.required) ?? false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this also have a test for explicitly setting required overriding the form control required state?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The forms module will log a deprecation warning if required is used on an element with formControl.

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jelbourn jelbourn added the action: merge The PR is ready for merge by the caretaker label Sep 7, 2021
@mmalerba mmalerba merged commit 64ba72f into angular:master Oct 5, 2021
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Nov 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement P2 The issue is important to a large percentage of users, with a workaround target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants