import { Component, OnInit } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; import { ILangPicker } from '../interfaces'; @Component({ selector: 'cmn-lang-picker', templateUrl: './lang-picker.component.html', styleUrls: [ './lang-picker.component.scss' ], }) export class LangPickerComponent implements OnInit { public value: string; public langs: ILangPicker[] = [ {id: 'en', label: 'english'}, {id: 'es', label: 'spanish', isActive: true}, ]; public ngOnInit(): void { this.value = this.langs.find((lang) => lang.isActive).id; } public onSelect(lang: ILangPicker) { this.value = lang.id; } }