diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js index a5fc56c82c3f..9fef56389530 100644 --- a/src/ng/directive/input.js +++ b/src/ng/directive/input.js @@ -678,7 +678,7 @@ function checkboxInputType(scope, element, attr, ctrl) { * {@link ng.directive:input input element}. * * @param {string} ngModel Assignable angular expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. + * @param {template} name Property name of the form under which the control is published. * @param {string=} required Sets `required` validation error key if the value is not entered. * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of @@ -916,8 +916,8 @@ var VALID_CLASS = 'ng-valid', * * */ -var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse', - function($scope, $exceptionHandler, $attr, $element, $parse) { +var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse', '$interpolate', + function($scope, $exceptionHandler, $attr, $element, $parse, $interpolate) { this.$viewValue = Number.NaN; this.$modelValue = Number.NaN; this.$parsers = []; @@ -927,7 +927,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$ this.$dirty = false; this.$valid = true; this.$invalid = false; - this.$name = $attr.name; + this.$name = $interpolate($attr.name || '')($scope) || undefined; var ngModelGet = $parse($attr.ngModel), ngModelSet = ngModelGet.assign; diff --git a/test/ng/directive/formSpec.js b/test/ng/directive/formSpec.js index f61734147fd6..f6b284f9f999 100644 --- a/test/ng/directive/formSpec.js +++ b/test/ng/directive/formSpec.js @@ -64,6 +64,18 @@ describe('form', function() { }); + it('should support a template as an alias', function() { + scope.alias = 'foo'; + doc = $compile( + '