angular - use ngx-translate in .ts file -
i want use translation in sidemenu titles, read this tutorial , solve as:
translate.get('home').subscribe(res => { this.pages= [ {title: res , component: homepage}, {title: 'my account', component: myaccountpage}, {title: 'changer pass' , component: changepasswordpage} ]
it works, problem want t many title translation file set them sidemenu titles.
please not use forkjoin
operator in case. ngx-translate supports fetching multiple translations @ once passing array of keys get()
method this:
translate.get(['home', 'my_account', 'change_password']).subscribe(translations => { this.pages= [ { title: translations.home, component: homepage}, { title: translations.my_account, component: myaccountpage}, { title: translations.change_password, component: changepasswordpage} ]; })
edit:
here can find supported methods , signature.
Comments
Post a Comment