diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js index 250a4520e025..dadf07c4c37b 100644 --- a/src/ng/directive/input.js +++ b/src/ng/directive/input.js @@ -576,8 +576,10 @@ function emailInputType(scope, element, attr, ctrl, $sniffer, $browser) { } function radioInputType(scope, element, attr, ctrl) { - // correct the name - element.attr('name', attr.id + '@' + attr.name); + // make the name unique, if not defined + if (isUndefined(attr.name)) { + element.attr('name', nextUid()); + } element.bind('click', function() { if (element[0].checked) { @@ -1144,9 +1146,9 @@ var CONSTANT_VALUE_REGEXP = /^(true|false|\d+)$/; var ngValueDirective = [function() { return { priority: 100, - compile: function(tpl, attr) { - if (CONSTANT_VALUE_REGEXP.test(attr.ngValue)) { - return function(scope) { + compile: function(tpl, tplAttr) { + if (CONSTANT_VALUE_REGEXP.test(tplAttr.ngValue)) { + return function(scope, elm, attr) { attr.$set('value', scope.$eval(attr.ngValue)); }; } else { diff --git a/test/ng/directive/inputSpec.js b/test/ng/directive/inputSpec.js index 9f8b21c476a1..6cecf125e48f 100644 --- a/test/ng/directive/inputSpec.js +++ b/test/ng/directive/inputSpec.js @@ -1106,5 +1106,49 @@ describe('input', function() { browserTrigger(inputElm.eq(1), 'click'); expect(scope.selected).toBe(2); }); + + + it('should work inside ngRepeat with primitive values', function() { + compileInput( + '