An @Input property that Gets/Sets format of time while igxTimePicker
does not have focus.
By default format
is set to hh:mm tt.
List of time-flags:
h
: hours field in 12-hours format without leading zero
hh
: hours field in 12-hours format with leading zero
H
: hours field in 24-hours format without leading zero
HH
: hours field in 24-hours format with leading zero
m
: minutes field without leading zero
mm
: minutes field with leading zero
tt
: 2 character string which represents AM/PM field
<igx-time-picker format="HH:m" id="time-picker"></igx-time-picker>
An @Input property that sets the value of the id
attribute.
<igx-time-picker [id]="'igx-time-picker-5'" format="h:mm tt" ></igx-time-picker>
An @Input property that determines the spin behavior. By default isSpinLoop
is set to true.
The minutes and hour spinning will wrap around by default.
<igx-time-picker [isSpinLoop]="false" id="time-picker"></igx-time-picker>
An @Input property that allows you to set the maxValue
to limit the user input.
public max: string = "18:00";
//..
<igx-time-picker format="HH:mm" [vertical]="true" [maxValue]="max"></igx-time-picker>
An @Input property that allows you to set the minValue
to limit the user input.
public min: string = "09:00";
//..
<igx-time-picker format="HH:mm" [vertical]="true" [minValue]="min"></igx-time-picker>
Emitted when a timePicker is being closed.
Emitted when a timePicker is being opened.
@ViewChild("toast")
private toast: IgxToastComponent;
public onOpen(timepicker){
this.toast.show();
}
//...
<igx-time-picker [minValue]="min" [maxValue]="max" (onOpen)="onOpen($event)"></igx-time-picker>
<igx-toast #toast message="The time picker has been opened!"></igx-toast>
Emitted when an invalid value is being set. Returns {timePicker
: any
, currentValue
: Date
, setThroughUI
: boolean
}
public min: string = "09:00";
public max: string = "18:00";
@ViewChild("toast")
private toast: IgxToastComponent;
public onValidationFailed(timepicker){
this.toast.show();
}
//...
<igx-time-picker [minValue]="min" [maxValue]="max" (onValidationFailed)="onValidationFailed($event)"></igx-time-picker>
<igx-toast #toast message="Value must be between 09:00 and 18:00!"></igx-toast>
Emitted when selection is made. The event contains the selected value. Returns {oldValue
: Date
, newValue
: Date
}.
@ViewChild("toast")
private toast: IgxToastComponent;
public onValueChanged(timepicker){
this.toast.show()
}
//...
<igx-time-picker (onValueChanged)="onValueChanged($event)"></igx-time-picker>
<igx-toast #toast message="The value has been changed!"></igx-toast>
An @Input property that Gets/Sets the orientation of the igxTimePicker
. By default vertical
is set to false.
<igx-time-picker [vertical]="true" id="time-picker"></igx-time-picker>
An accessor that returns the label of cancel button.
An @Input property that renders cancel button with custom text.
By default cancelButtonLabel
is set to Cancel.
<igx-time-picker cancelButtonLabel='Exit' [value]="date" format="h:mm tt"></igx-time-picker>
Gets the context passed to the input group template.
Returns the current time formatted as string using the format
option.
If there is no set time the return is an empty string.
@ViewChild("MyChild")
private picker: IgxTimePickerComponent;
ngAfterViewInit(){
let time = this.picker.displayTime;
}
An accessor that returns the label of ok button.
An @Input property that renders OK button with custom text. By default okButtonLabel
is set to OK.
<igx-time-picker okButtonLabel='SET' [value]="date" format="h:mm tt"></igx-time-picker>
An accessor that returns the resource strings.
An accessor that sets the resource strings. By default it uses EN resources.
Gets the input group template.
let template = this.template();
An accessor that returns the value of igx-time-picker
component.
@ViewChild("MyPick")
public pick: IgxTimePickerComponent;
ngAfterViewInit(){
let pickSelect = this.pick.value;
}
An accessor that allows you to set a time using the value
input.
public date: Date = new Date(Date.now());
//...
<igx-time-picker [value]="date" format="h:mm tt"></igx-time-picker>
Returns an array of the AM/PM currently in view.
@ViewChild("MyChild")
private picker: IgxTimePickerComponent;
ngAfterViewInit(){
let ApInView = this.picker.ampmInView;
}
Closes the dialog without selecting the current value.
<igx-dialog class="igx-time-picker__dialog-popup" [leftButtonLabel]="cancelButtonLabel" (onLeftButtonSelect)="cancelButtonClick()">
//...
</igx-dialog>
Returns an array of the hours currently in view.
@ViewChild("MyChild")
private picker: IgxTimePickerComponent;
ngAfterViewInit(){
let hInView = this.picker.hoursInView;
}
Returns an array of the minutes currently in view.
@ViewChild("MyChild")
private picker: IgxTimePickerComponent;
ngAfterViewInit(){
let minInView = this.picker.minutesInView;
}
If current value is valid selects it, closes the dialog and returns true, otherwise returns false.
<igx-dialog class="igx-time-picker__dialog-popup" [rightButtonLabel]="okButtonLabel" (onRightButtonSelect)="okButtonClick()">
//..
</igx-dialog>
opens the dialog.
<igx-time-picker #tp></igx-time-picker>
@ViewChild('tp', { read: IgxTimePickerComponent }) tp: IgxTimePickerComponent;
tp.openDialog();
Scrolls an ampm item into view.
scrAmPmIntoView(tp) {
tp.scrollAmPmIntoView('PM');
}
<igx-time-picker #tp format="h:mm tt" (onOpen)="scrAmPmIntoView(tp)"></igx-time-picker>
to be scrolled in view.
Scrolls a hour item into view.
scrhintoView(tp) {
tp.scrollHourIntoView('2');
}
<igx-time-picker #tp format="h:mm tt" (onOpen)="scrhintoView(tp)"></igx-time-picker>
to be scrolled in view.
Scrolls a minute item into view.
scrMintoView(tp) {
tp.scrollMinuteIntoView('3');
}
<igx-time-picker #tp format="h:mm tt" (onOpen)="scrMintoView(tp)"></igx-time-picker>
to be scrolled in view.
An @Input property that gets/sets the delta by which hour and minute items would be changed
when the user presses the Up/Down keys.
By default itemsDelta
is set to {hours: 1, minutes:1}
<igx-time-picker [itemsDelta]="{hours:3, minutes:5}" id="time-picker"></igx-time-picker>
An @Input property that allows you to disable the
igx-time-picker
component. By defaultdisabled
is set to false.<igx-time-picker [disabled]="'true'" [vertical]="true" format="h:mm tt" ></igx-time-picker>