Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Directly call $setTouched
  • Loading branch information
alexanderchan committed Oct 28, 2014
commit b0821af4af4516457686d3970bef2bb9c7838862
8 changes: 2 additions & 6 deletions src/ng/directive/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -2459,14 +2459,10 @@ var ngModelDirective = function() {

element.on('blur', function(ev) {
if (modelCtrl.$touched) return;

var onBlurSetTouched = function() {
modelCtrl.$setTouched();
};
if (scope.$$phase) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

@Narretz means $rootScope.$$phase (just clearing it up to avoid confusion 😈).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good I'll try to update that. I followed 719c747#diff-eefe7d65b6795cba34d2b08a27ebf2beR63 which only checked scope.$$phase.

Just to help my understanding is there a reason $rootScope.$$phase isn't used there? @tbosch thanks!

Ahh, sorry I see now, it came afterwards I should have checked the most recent version. Thanks for the tips guys.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the clarification @gkalpak Why $rootScope is explained here: #8849 (comment)

scope.$evalAsync(onBlurSetTouched);
scope.$evalAsync(modelCtrl.$setTouched);
} else {
scope.$apply(onBlurSetTouched);
scope.$apply(modelCtrl.$setTouched);
}
});
}
Expand Down