-
Notifications
You must be signed in to change notification settings - Fork 398
fix(FormlyFormController): Fix validateOnModelChange not firing with promise change #523 #728
Conversation
…promise change Fixes validate being called with undefined this variable scope. Closes formly-js#523
|
There were the following issues with your Pull Request
Guidelines are available at https://github.com/formly-js/angular-formly/blob/master/CONTRIBUTING.md This message was auto-generated by https://gitcop.com |
Current coverage is 95.93% (diff: 100%)@@ master #728 diff @@
==========================================
Files 17 17
Lines 1181 1181
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
Hits 1133 1133
Misses 48 48
Partials 0 0
|
kentcdodds
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine. Thank you.
|
Could someone from @angular-formly-collaborators review and merge this? |
|
Sorry, bad @ mention. Someone from @formly-js/angular-formly-collaborators please review and merge this. Thanks. |
| promise.then(validate) | ||
| promise.then(() => validate.apply(formControl)) | ||
| } else { | ||
| validate() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking that the problem is that the validate function isn't being called with the right this context. Honestly, I'd prefer the use of bind personally, but I don't care either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. LGTM
…ange (formly-js#728) (#1) Fixes validate being called with undefined this variable scope. Closes formly-js#523
What
In FormlyFormController in function validateFormControl variable validate was invoked with "undefined" this if the function was called with a promise.
Why
It's a bug.
How
Used a closure and apply() to ensure validate() will be called with formController as this.
For issue #523
Checklist:
Fixes validate being called with undefined this variable scope.
Closes #523