You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
feat(mdInput): Add support for both labels and placeholders.
Previously, if a user supplied both a placeholder and a label,
the label would float on top of the placeholder when the input
did not have a value.
Fix by adding styles/code to support both at the same time.
**Note:** If the users provides both a label and a placeholder,
the label will no longer animate.
Also fix input styles so transition does not happen if input
already has a value to avoid unneccessary and eratic-looking
animations.
Fixes#4462. Fixes#4258.
* Input and textarea elements will not behave properly unless the md-input-container
27
27
* parent is provided.
28
28
*
29
-
* @param md-is-error {expression=} When the given expression evaluates to true, the input container will go into error state. Defaults to erroring if the input has been touched and is invalid.
30
-
* @param md-no-float {boolean=} When present, placeholders will not be converted to floating labels
29
+
* @param md-is-error {expression=} When the given expression evaluates to true, the input container
30
+
* will go into error state. Defaults to erroring if the input has been touched and is invalid.
31
+
* @param md-no-float {boolean=} When present, placeholders will not be converted to floating
32
+
* labels.
31
33
*
32
34
* @usage
33
35
* <hljs lang="html">
@@ -54,6 +56,7 @@ function mdInputContainerDirective($mdTheming, $parse) {
54
56
functionpostLink(scope,element,attr){
55
57
$mdTheming(element);
56
58
}
59
+
57
60
functionContainerCtrl($scope,$element,$attrs){
58
61
varself=this;
59
62
@@ -69,6 +72,9 @@ function mdInputContainerDirective($mdTheming, $parse) {
* Use the `<input>` or the `<textarea>` as a child of an `<md-input-container>`.
108
114
*
109
-
* @param {number=} md-maxlength The maximum number of characters allowed in this input. If this is specified, a character counter will be shown underneath the input.<br/><br/>
110
-
* The purpose of **`md-maxlength`** is exactly to show the max length counter text. If you don't want the counter text and only need "plain" validation, you can use the "simple" `ng-maxlength` or maxlength attributes.
111
-
* @param {string=} aria-label Aria-label is required when no label is present. A warning message will be logged in the console if not present.
112
-
* @param {string=} placeholder An alternative approach to using aria-label when the label is not present. The placeholder text is copied to the aria-label attribute.
115
+
* @param {number=} md-maxlength The maximum number of characters allowed in this input. If this is
116
+
* specified, a character counter will be shown underneath the input.<br/><br/>
117
+
* The purpose of **`md-maxlength`** is exactly to show the max length counter text. If you don't
118
+
* want the counter text and only need "plain" validation, you can use the "simple" `ng-maxlength`
119
+
* or maxlength attributes.
120
+
* @param {string=} aria-label Aria-label is required when no label is present. A warning message
121
+
* will be logged in the console if not present.
122
+
* @param {string=} placeholder An alternative approach to using aria-label when the label is not
123
+
* PRESENT. The placeholder text is copied to the aria-label attribute.
113
124
* @param md-no-autogrow {boolean=} When present, textareas will not grow automatically.
114
125
*
115
126
* @usage
@@ -168,13 +179,13 @@ function inputTextareaDirective($mdUtil, $window, $mdAria) {
168
179
varngModelCtrl=ctrls[1]||$mdUtil.fakeNgModel();
169
180
varisReadonly=angular.isDefined(attr.readonly);
170
181
171
-
if(!containerCtrl)return;
182
+
if(!containerCtrl)return;
172
183
if(containerCtrl.input){
173
184
thrownewError("<md-input-container> can only have *one* <input>, <textarea> or <md-select> child element!");
0 commit comments