diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js index da3b4944d45f..7b5882d48942 100644 --- a/src/ng/directive/input.js +++ b/src/ng/directive/input.js @@ -1753,7 +1753,9 @@ function radioInputType(scope, element, attr, ctrl) { ctrl.$render = function() { var value = attr.value; - element[0].checked = (value === ctrl.$viewValue); + // We generally use strict comparison. This is behavior we cannot change without a BC. + // eslint-disable-next-line eqeqeq + element[0].checked = (value == ctrl.$viewValue); }; attr.$observe('value', ctrl.$render); diff --git a/test/ng/directive/inputSpec.js b/test/ng/directive/inputSpec.js index 1d81f9a5efcf..1de73f9266b2 100644 --- a/test/ng/directive/inputSpec.js +++ b/test/ng/directive/inputSpec.js @@ -3871,6 +3871,17 @@ describe('input', function() { }); + it('should use non-strict comparison between model and value', function() { + $rootScope.selected = false; + var inputElm = helper.compileInput('' + + '' + + ''); + + expect(inputElm[0].checked).toBe(true); + expect(inputElm[1].checked).toBe(true); + expect(inputElm[2].checked).toBe(true); + }); + it('should watch the expression', function() { var inputElm = helper.compileInput('');