if i am using the translate service in angular4+

Can i share data between components just importing this 
translateService. Pretty much I want that service to remember which 
language I set it to. Or is this something i need to create my own service 
for to share the language i set my app to in order to get it in between 
components. 
import { TranslateService } from '@ngx-translate/core';


 constructor(public translate: TranslateService, public data: DataService) {
   this.data = data;
   translate.addLangs(['en', 'fr']);
   const browserLang: string = translate.getBrowserLang();
   translate.use(browserLang.match(/en|fr/) ? browserLang : 'en');

}





how could I then in another component figure out which 
languauge translate.use() was already set to? Or can the translateService 
not persist data between components and i would have to use the DataService 
that i wrote myself to store it?

Thanks 

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to