/** * Created by Menna on 8/24/16. */ import { ElementRef, Input, Component, AfterViewInit, ViewChild } from '@angular/core'; import { Mediator } from '../../services/mediator'; import { CoreMediatorChannels } from '../../utils/mediator-channels'; import { TranslateService } from '../../services/translate-service'; import { TimePicker } from './timepicker.widget'; import TimePickerOptions = kendo.ui.TimePickerOptions; @Component({ selector: 'kendo_timepicker', template: ``, //styleUrls: ['./datetimepicker.widget.css'] }) export class TimePickerComponent implements AfterViewInit { @Input() private options: TimePickerOptions; @ViewChild('timePickerRef') private element: ElementRef; private protoType: TimePicker; private lang = ''; constructor(private translateService: TranslateService) { this.lang = this.translateService.instant('lang-key'); } ngAfterViewInit() { this.protoType = new TimePicker(this.element.nativeElement, this.options); if (this.lang == 'ar') { this.protoType.options.culture = "ar-EG"; this.protoType.setOptions(this.protoType.options); } Mediator.subscribe(CoreMediatorChannels.CHANGE_SYSTEM_LANGUAGE, () => { this.lang = this.translateService.instant('lang-key'); if (this.lang == 'ar') { this.protoType.options.culture = "ar-EG"; this.protoType.setOptions(this.protoType.options); } else { this.protoType.options.culture = ""; this.protoType.setOptions(this.protoType.options); } }); } get ProtoType(): TimePicker { return this.protoType; } set ProtoType(protoType: TimePicker) { this.protoType = protoType; } }