Skip to content

Commit 692d296

Browse files
committed
fix(input): Firefox validation trigger
Do not trigger Firefox validation on form initialization. - Do not set a value to an <input> field if the field already has the same value Closes angular#12102
1 parent 71fc3f4 commit 692d296

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/ng/directive/input.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,11 @@ function baseInputType(scope, element, attr, ctrl, $sniffer, $browser) {
11251125
element.on('change', listener);
11261126

11271127
ctrl.$render = function() {
1128-
element.val(ctrl.$isEmpty(ctrl.$viewValue) ? '' : ctrl.$viewValue);
1128+
// Workaround for Firefox validation #12102.
1129+
var value = ctrl.$isEmpty(ctrl.$viewValue) ? '' : ctrl.$viewValue;
1130+
if (element.val() !== value) {
1131+
element.val(value);
1132+
}
11291133
};
11301134
}
11311135

0 commit comments

Comments
 (0)