@@ -532,12 +532,16 @@ export class IgxTimePickerComponent implements
532532 /**
533533 * @hidden
534534 */
535- @ViewChild ( 'input' , { read : ElementRef , static : false } )
536- private input : ElementRef ;
535+ @ViewChild ( 'input' , { read : ElementRef } )
536+ private inputElementRef : ElementRef ;
537537
538538 @ViewChild ( IgxInputDirective , { read : IgxInputDirective } )
539539 private _inputDirective : IgxInputDirective ;
540540
541+ /** @hidden @internal */
542+ @ContentChild ( IgxInputDirective )
543+ protected input : IgxInputDirective ;
544+
541545 /**
542546 * @hidden
543547 */
@@ -826,8 +830,8 @@ export class IgxTimePickerComponent implements
826830 * @hidden
827831 */
828832 public ngAfterViewInit ( ) : void {
829- if ( this . mode === InteractionMode . DropDown && this . input ) {
830- fromEvent ( this . input . nativeElement , 'keydown' ) . pipe (
833+ if ( this . mode === InteractionMode . DropDown && this . inputElementRef ) {
834+ fromEvent ( this . inputElementRef . nativeElement , 'keydown' ) . pipe (
831835 throttle ( ( ) => interval ( 0 , animationFrameScheduler ) ) ,
832836 takeUntil ( this . _destroy$ )
833837 ) . subscribe ( ( event : KeyboardEvent ) => {
@@ -1271,11 +1275,11 @@ export class IgxTimePickerComponent implements
12711275 }
12721276
12731277 private _getCursorPosition ( ) : number {
1274- return this . input . nativeElement . selectionStart ;
1278+ return this . inputElementRef . nativeElement . selectionStart ;
12751279 }
12761280
12771281 private _setCursorPosition ( start : number , end : number = start ) : void {
1278- this . input . nativeElement . setSelectionRange ( start , end ) ;
1282+ this . inputElementRef . nativeElement . setSelectionRange ( start , end ) ;
12791283 }
12801284
12811285 private _updateEditableInput ( ) : void {
@@ -1894,8 +1898,8 @@ export class IgxTimePickerComponent implements
18941898 }
18951899
18961900 // minor hack for preventing cursor jumping in IE
1897- this . displayValue = this . inputFormat . transform ( displayVal ) ;
1898- this . input . nativeElement . value = this . displayValue ;
1901+ this . _displayValue = this . inputFormat . transform ( displayVal ) ;
1902+ this . inputElementRef . nativeElement . value = this . _displayValue ;
18991903 this . _setCursorPosition ( cursor ) ;
19001904
19011905 requestAnimationFrame ( ( ) => {
@@ -1930,10 +1934,11 @@ export class IgxTimePickerComponent implements
19301934
19311935 private updateValidity ( ) {
19321936 this . _onTouchedCallback ( ) ;
1937+ const inputDirective = this . _inputDirective || this . input ;
19331938 if ( this . _ngControl && ! this . _ngControl . valid ) {
1934- this . _inputDirective . valid = IgxInputState . INVALID ;
1939+ inputDirective . valid = IgxInputState . INVALID ;
19351940 } else {
1936- this . _inputDirective . valid = IgxInputState . INITIAL ;
1941+ inputDirective . valid = IgxInputState . INITIAL ;
19371942 }
19381943 }
19391944}
0 commit comments