API reference for Angular Material timepicker
import {MatTimepickerModule} from '@angular/material/timepicker';
Directives
MatTimepicker
Renders out a listbox that can be used to select a time of day.
Intended to be used together with MatTimepickerInput
.
Selector: mat-timepicker
Exported as: matTimepickerProperties
Name | Description |
---|---|
|
ID of the active descendant option. |
|
ARIA label for the timepicker panel. |
|
ID of the label element for the timepicker panel. |
|
Emits when the timepicker is closed. |
|
Whether ripples within the timepicker should be disabled. |
|
Whether the timepicker is currently disabled. |
|
Interval between each option in the timepicker. The value can either be an amount of
seconds (e.g. 90) or a number with a unit (e.g. 45m). Supported units are |
|
Whether the timepicker is open. |
|
Emits when the timepicker is opened. |
|
Array of pre-defined options that the user can select from, as an alternative to using the
|
|
Unique ID of the timepicker's panel |
|
Emits when the user selects a time. |
Methods
close | |
---|---|
Closes the timepicker. |
open | |
---|---|
Opens the timepicker. |
registerInput | |
---|---|
Registers an input with the timepicker. |
|
Parameters | |
input MatTimepickerInput<D>
|
|
MatTimepickerInput
Input that can be used to enter time and connect to a mat-timepicker
.
Selector: input[matTimepicker]
Exported as: matTimepickerInputProperties
Name | Description |
---|---|
|
Whether the input is disabled. |
|
Maximum time that can be selected or typed in. Can be either a date object (only time will be used) or a valid time string. |
|
Minimum time that can be selected or typed in. Can be either a date object (only time will be used) or a valid time string. |
|
Timepicker that the input is associated with. |
|
Current value of the input. |
Methods
focus | |
---|---|
Focuses the input. |
getOverlayOrigin | |
---|---|
Gets the element to which the timepicker popup should be attached. |
|
Returns | |
ElementRef<HTMLElement>
|
|
MatTimepickerToggle
Button that can be used to open a mat-timepicker
.
Selector: mat-timepicker-toggle
Exported as: matTimepickerToggleProperties
Name | Description |
---|---|
|
Screen-reader label for the button. |
|
Whether ripples on the toggle should be disabled. |
|
Whether the toggle button is disabled. |
|
Timepicker instance that the button will toggle. |
Interfaces
MatTimepickerOption
Time selection option that can be displayed within a mat-timepicker
.
Properties
Name | Description |
---|---|
|
Label to show to the user. |
|
Date value of the option. |
MatTimepickerConfig
Object that can be used to configure the default options for the timepicker component.
Properties
Name | Description |
---|---|
|
Whether ripples inside the timepicker should be disabled by default. |
|
Default interval for all time pickers. |
MatTimepickerSelected
Event emitted when a value is selected in the timepicker.
Properties
Name | Description |
---|---|
|
|
|
Constants
MAT_TIMEPICKER_CONFIG
Injection token that can be used to configure the default options for the timepicker component.
const MAT_TIMEPICKER_CONFIG: InjectionToken<MatTimepickerConfig>;
API reference for Angular Material timepicker-testing
import {MatTimepickerHarness} from '@angular/material/timepicker/testing';
Classes
MatTimepickerHarness
extends
ComponentHarness
Properties
Name | Description |
---|---|
|
Methods
async
getOptions
|
|
---|---|
Gets the options inside the timepicker panel. |
|
Parameters | |
filters? Omit<OptionHarnessFilters, "ancestor">
|
|
Returns | |
Promise<MatOptionHarness[]>
|
|
async
host
|
|
---|---|
Gets a |
|
Returns | |
Promise<TestElement>
|
|
async
isOpen
|
|
---|---|
Whether the timepicker is open. |
|
Returns | |
Promise<boolean>
|
|
async
selectOption
|
|
---|---|
Selects the first option matching the given filters. |
|
Parameters | |
filters OptionHarnessFilters
|
|
Returns | |
Promise<void>
|
Promise that resolves when the action completes. |
static
with
|
|
---|---|
Gets a |
|
Parameters | |
options TimepickerHarnessFilters = {}
|
Options for filtering which timepicker instances are considered a match. |
Returns | |
HarnessPredicate<T>
|
a |
MatTimepickerInputHarness
extends
ComponentHarness
Harness for interacting with a standard Material timepicker inputs in tests.
Properties
Name | Description |
---|---|
|
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
closeTimepicker
|
|
---|---|
Closes the timepicker associated with the input. |
|
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
getPlaceholder
|
|
---|---|
Gets the placeholder of the input. |
|
Returns | |
Promise<string>
|
|
async
getTimepicker
|
|
---|---|
Gets the |
|
Parameters | |
filter TimepickerHarnessFilters = {}
|
Optionally filters which timepicker is included. |
Returns | |
Promise<MatTimepickerHarness>
|
|
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
isRequired
|
|
---|---|
Whether the input is required. |
|
Returns | |
Promise<boolean>
|
|
async
isTimepickerOpen
|
|
---|---|
Gets whether the timepicker associated with the input is open. |
|
Returns | |
Promise<boolean>
|
|
async
openTimepicker
|
|
---|---|
Opens the timepicker associated with the input and returns the timepicker instance. |
|
Returns | |
Promise<MatTimepickerHarness>
|
|
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. |
static
with
|
|
---|---|
Gets a |
|
Parameters | |
options TimepickerInputHarnessFilters = {}
|
Options for filtering which input instances are considered a match. |
Returns | |
HarnessPredicate<T>
|
a |
MatTimepickerToggleHarness
extends
ComponentHarness
Harness for interacting with a standard Material timepicker toggle in tests.
Properties
Name | Description |
---|---|
|
Methods
async
host
|
|
---|---|
Gets a |
|
Returns | |
Promise<TestElement>
|
|
async
isDisabled
|
|
---|---|
Whether the toggle is disabled. |
|
Returns | |
Promise<boolean>
|
|
async
isTimepickerOpen
|
|
---|---|
Gets whether the timepicker associated with the toggle is open. |
|
Returns | |
Promise<boolean>
|
|
async
openTimepicker
|
|
---|---|
Opens the timepicker associated with the toggle. |
|
Returns | |
Promise<void>
|
Promise that resolves when the action completes. |
static
with
|
|
---|---|
Gets a |
|
Parameters | |
options TimepickerToggleHarnessFilters = {}
|
Options for filtering which timepicker toggle instances are considered a match. |
Returns | |
HarnessPredicate<MatTimepickerToggleHarness>
|
a |
Interfaces
TimepickerHarnessFilters
A set of criteria that can be used to filter a list of MatTimepickerHarness
instances.
TimepickerInputHarnessFilters
A set of criteria that can be used to filter a list of timepicker input instances.
Properties
Name | Description |
---|---|
|
Filters based on the placeholder text of the input. |
|
Filters based on the value of the input. |
TimepickerToggleHarnessFilters
A set of criteria that can be used to filter a list of timepicker toggle instances.