Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

WIP fix(ngRequired): always evaluate ngRequired at least once #16815

Closed
wants to merge 1 commit into from

Conversation

codymikol
Copy link

when ngRequired is initially false the required attribute will now be
updated properly.

Fixes: ##16814

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

Bug Fix

What is the current behavior? (You can also link to an open issue here)

#16814

Currently if the ngRequired starts as a false value the old value and the new value will be the same in the $observe and so ctrl.$validate() will not be called. This is a problem because by default the attr.required is set to true.

What is the new behavior (if this is a feature change)?

Now the ngRequired $observe will always validate on the first mutation.

Does this PR introduce a breaking change?

No

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Fix/Feature: Docs have been added/updated
  • Fix/Feature: Tests have been added; existing tests pass

Other information:

when ngRequired is initially false the required attribute will now be
updated properly.

Fixes: #angular#16814
@codymikol codymikol changed the title fix(ngRequired): always evaluate ngRequired at least once WIP fix(ngRequired): always evaluate ngRequired at least once Jan 18, 2019
@codymikol
Copy link
Author

I'll have to review these failing tests tonight, but this does seem to be the root of the problem.

@Narretz
Copy link
Contributor

Narretz commented Jan 21, 2019

Thanks for the PR @codymikol - I have an alternative here that doesn't need the extra variable, can you check if this looks good to you: #16820?

@codymikol
Copy link
Author

Yes, this looks good 👍 Thanks for the fix!

@codymikol codymikol closed this Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants