diff --git a/src/components/input/input.js b/src/components/input/input.js index 3d2888b52d8..0fcd1704b43 100644 --- a/src/components/input/input.js +++ b/src/components/input/input.js @@ -308,7 +308,7 @@ function inputTextareaDirective($mdUtil, $window, $mdAria, $timeout, $mdGesture) element.after(errorsSpacer); if (!containerCtrl.label) { - $mdAria.expect(element, 'aria-label', element.attr('placeholder')); + $mdAria.expect(element, 'aria-label', attr.placeholder); } element.addClass('md-input'); @@ -660,15 +660,22 @@ function mdMaxlengthDirective($animate, $mdUtil) { } } -function placeholderDirective($log) { +function placeholderDirective($compile) { return { restrict: 'A', require: '^^?mdInputContainer', priority: 200, - link: postLink + link: { + // Note that we need to do this in the pre-link, as opposed to the post link, if we want to + // support data bindings in the placeholder. This is necessary, because we have a case where + // we transfer the placeholder value to the `