import { Component, OnInit, OnDestroy, ContentChild, TemplateRef } from '@angular/core'; import { CmI18nService, zh, en } from '../../service/i18n.service'; @Component({ selector: 'cm-datepicker', templateUrl: './datePicker.component.html', styleUrls: ['./datePicker.component.less'] }) export class datePickerComponent implements OnInit, OnDestroy { zh = zh; en = en; lang: string; @ContentChild(TemplateRef) template: TemplateRef; constructor(public i18n: CmI18nService) { this.i18n.missionLang$.subscribe(lang => { this.lang = lang; }) } ngOnInit() { this.i18n.use(this.i18n.defaultLang); } ngOnDestroy() { } }