Improve this Doc View Source textarea
- directive in module ng
Overview
HTML textarea element control with AngularJS data-binding. The data-binding and validation properties of this element are exactly the same as those of the input element.
Known Issues
When specifying the placeholder
attribute of <textarea>
, Internet Explorer will temporarily insert the placeholder value as the textarea's content. If the placeholder value contains interpolation ({{ ... }}
), an error will be logged in the console when AngularJS tries to update the value of the by-then-removed text node. This doesn't affect the functionality of the textarea, but can be undesirable.
You can work around this Internet Explorer issue by using ng-attr-placeholder
instead of placeholder
on textareas, whenever you need interpolation in the placeholder value. You can find more details on ngAttr
in the Interpolation section of the Developer Guide.
Directive Info
- This directive executes at priority level 0.
Usage
- as element:
<textarea ng-model="string" [name="string"] [required="string"] [ng-required="string"] [ng-minlength="number"] [ng-maxlength="number"] [ng-pattern="string"] [ng-change="string"] [ng-trim="boolean"]> ... </textarea>
Arguments
Param | Type | Details |
---|---|---|
ngModel | string | Assignable AngularJS expression to data-bind to. |
name (optional) | string | Property name of the form under which the control is published. |
required (optional) | string | Sets |
ngRequired (optional) | string | Adds |
ngMinlength (optional) | number | Sets |
ngMaxlength (optional) | number | Sets |
ngPattern (optional) | string | Sets |
ngChange (optional) | string | AngularJS expression to be executed when input changes due to user interaction with the input element. |
ngTrim (optional) | boolean | If set to false AngularJS will not automatically trim the input. (default: true) |
© 2010–2018 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://code.angularjs.org/1.7.8/docs/api/ng/directive/textarea