API reference for Angular Material input
import {MatInputModule} from '@angular/material/input';
Directives
MatTextareaAutosize
extends
CdkTextareaAutosize
Directive to automatically resize a textarea to fit its content.
Selector: textarea[mat-autosize] textarea[matTextareaAutosize]
Exported as: matTextareaAutosizeProperties
Name | Description |
---|---|
@Input('cdkTextareaAutosize')
|
Whether autosizing is enabled or not |
@Input('mat-autosize')
|
|
@Input()
|
|
@Input()
|
|
@Input()
|
|
@Input('cdkAutosizeMaxRows')
|
Maximum amount of rows in the textarea. |
@Input('cdkAutosizeMinRows')
|
Minimum amount of rows in the textarea. |
Methods
reset | |
---|---|
Resets the textarea to its original size |
resizeToFitContent | |
---|---|
Resize the textarea to fit its content. |
|
Parameters | |
force boolean = false
|
Whether to force a height recalculation. By default the height will be recalculated only if the value changed since the last call. |
MatInput
Directive that allows a native input to work inside a MatFormField
.
Selector: input[matInput] textarea[matInput] select[matNativeControl] input[matNativeControl] textarea[matNativeControl]
Exported as: matInputProperties
Name | Description |
---|---|
@Input()
|
An object used to control when error messages are shown. |
@Input()
|
Whether the element is readonly. |
@Input()
|
Input type of the element. |
|
Methods
focus | |
---|---|
Focuses the input. |
|
Parameters | |
options? FocusOptions
|
|
updateErrorState |
---|
Constants
MAT_INPUT_VALUE_ACCESSOR
This token is used to inject the object whose value should be set into MatInput
. If none is
provided, the native HTMLInputElement
is used. Directives like MatDatepickerInput
can provide
themselves for this token, in order to make MatInput
delegate the getting and setting of the
value to them.
const MAT_INPUT_VALUE_ACCESSOR: InjectionToken<{ value: any; }>;
API reference for Angular Material input-testing
import {MatInputHarness} from '@angular/material/input/testing';
Classes
MatInputHarness
extends
MatFormFieldControlHarness
Harness for interacting with a standard Material inputs in tests.
Methods
async
blur
|
|
---|---|
Blurs the input and returns a promise that indicates when the action is complete. |
|
Returns | |
Promise<void>
|
Promise that resolves when the action completes. |
async
focus
|
|
---|---|
Focuses the input and returns a promise that indicates when the action is complete. |
|
Returns | |
Promise<void>
|
Promise that resolves when the action completes. |
async
getId
|
|
---|---|
Gets the id of the input. |
|
Returns | |
Promise<string>
|
|
async
getName
|
|
---|---|
Gets the name of the input. |
|
Returns | |
Promise<string>
|
|
async
getPlaceholder
|
|
---|---|
Gets the placeholder of the input. |
|
Returns | |
Promise<string>
|
|
async
getType
|
|
---|---|
Gets the type of the input. Returns "textarea" if the input is a textarea. |
|
Returns | |
Promise<string>
|
|
async
getValue
|
|
---|---|
Gets the value of the input. |
|
Returns | |
Promise<string>
|
|
async
host
|
|
---|---|
Gets a |
|
Returns | |
Promise<TestElement>
|
|
async
isDisabled
|
|
---|---|
Whether the input is disabled. |
|
Returns | |
Promise<boolean>
|
|
async
isFocused
|
|
---|---|
Whether the input is focused. |
|
Returns | |
Promise<boolean>
|
|
async
isReadonly
|
|
---|---|
Whether the input is readonly. |
|
Returns | |
Promise<boolean>
|
|
async
isRequired
|
|
---|---|
Whether the input is required. |
|
Returns | |
Promise<boolean>
|
|
async
setValue
|
|
---|---|
Sets the value of the input. The value will be set by simulating keypresses that correspond to the given value. |
|
Parameters | |
newValue string
|
|
Returns | |
Promise<void>
|
Promise that resolves when the action completes. |
Interfaces
InputHarnessFilters
A set of criteria that can be used to filter a list of MatInputHarness
instances.
Properties
Name | Description |
---|---|
|
Filters based on the placeholder text of the input. |
|
Filters based on the value of the input. |