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

refactor(ngModel): use minErr directly for correct doc creation #12416

Closed
wants to merge 1 commit into from

Conversation

Narretz
Copy link
Contributor

@Narretz Narretz commented Jul 23, 2015

The minerr_errors extractor of the closure compiler cannot detect minErrs that are not
thrown in the form of 'throw minErr(...'

This causes the error page code blocks which display the error template to stay empty.

@@ -599,7 +596,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
forEach(ctrl.$asyncValidators, function(validator, name) {
var promise = validator(modelValue, viewValue);
if (!isPromiseLike(promise)) {
throw $ngModelMinErr("$asyncValidators",
throw minErr('ngModel')("$asyncValidators",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is actually a separate problem, too: there's no error page for "$asyncValidators" (and the err code doesn't conform to our standards)

@Narretz
Copy link
Contributor Author

Narretz commented Aug 7, 2015

@lgalfaso can you give this a quick review?

@lgalfaso
Copy link
Contributor

lgalfaso commented Aug 7, 2015

LGTM

Remove the `new` from the minErr assignment, so the closure compiler
can detect the errors correctly. Also removes the leading $ from the
variable name to be consistent with the Angular.js file.

Closes angular#12386
@Narretz
Copy link
Contributor Author

Narretz commented Aug 8, 2015

I realized that the closure compiler can detect the minErr if is assigned to another variable, we just need to remove the new, as it is done in the Angular.js file.

Narretz added a commit that referenced this pull request Aug 8, 2015
Remove the `new` from the minErr assignment, so the closure compiler
can detect the errors correctly. Also removes the leading $ from the
variable name to be consistent with the Angular.js file.

Closes #12386
Closes #12416
ggershoni pushed a commit to ggershoni/angular.js that referenced this pull request Sep 29, 2015
Remove the `new` from the minErr assignment, so the closure compiler
can detect the errors correctly. Also removes the leading $ from the
variable name to be consistent with the Angular.js file.

Closes angular#12386
Closes angular#12416
ggershoni pushed a commit to ggershoni/angular.js that referenced this pull request Sep 29, 2015
Remove the `new` from the minErr assignment, so the closure compiler
can detect the errors correctly. Also removes the leading $ from the
variable name to be consistent with the Angular.js file.

Closes angular#12386
Closes angular#12416
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants