Skip to content

Instantly share code, notes, and snippets.

@Tuizi
Created September 21, 2017 14:14
Show Gist options
  • Save Tuizi/af8272a28d4e837875bcc0118df0d7e6 to your computer and use it in GitHub Desktop.
Save Tuizi/af8272a28d4e837875bcc0118df0d7e6 to your computer and use it in GitHub Desktop.
@Component({
selector: 'i-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {
lang$: Observable<string>;
constructor(private readonly translate: TranslateService,
private readonly store: Store<fromRoot.State>) {
this.translate.setDefaultLang('en');
this.lang$ = this.store.select(fromRoot.getCurrentLanguage);
}
ngOnInit() {
this.lang$.subscribe(lang => this.translate.use(lang));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment