Text field

API for text-field

API reference for Angular CDK text-field

import {TextFieldModule} from '@angular/cdk/text-field';

An injectable service that can be used to monitor the autofill state of an input. Based on the following blog post: https://medium.com/@brunn/detecting-autofilled-fields-in-javascript-aed598d25da7

Methods
monitor

Monitor for changes in the autofill state of the given input element.

Parameters

element

Element

The element to monitor.

Returns
Observable<AutofillEvent>

A stream of autofill state changes.

monitor

Monitor for changes in the autofill state of the given input element.

Parameters

element

ElementRef<Element>

The element to monitor.

Returns
Observable<AutofillEvent>

A stream of autofill state changes.

stopMonitoring
Parameters

elementOrRef

Element | ElementRef<Element>

A directive that can be used to monitor the autofill state of an input.

Selector: [cdkAutofill]

Properties
Name Description
@Output()

cdkAutofill: EventEmitter<AutofillEvent>

Emits when the autofill state of the element changes.

Directive to automatically resize a textarea to fit its content.

Selector: textarea[cdkTextareaAutosize]

Exported as: cdkTextareaAutosize
Properties
Name Description
@Input('cdkTextareaAutosize')

enabled: boolean

Whether autosizing is enabled or not

@Input('cdkAutosizeMaxRows')

maxRows: number

Maximum amount of rows in the textarea.

@Input('cdkAutosizeMinRows')

minRows: number

Minimum amount of rows in the textarea.

Methods
reset

Resets the textarea to it's 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.

An event that is emitted when the autofill state of an input changes.

type AutofillEvent = {
    target: Element;
    isAutofilled: boolean;
};