Last active
          September 16, 2022 13:39 
        
      - 
      
- 
        Save chriseugenerodriguez/46b6699c590a4f596f4a18538d8cf5fb to your computer and use it in GitHub Desktop. 
    ngx-translate multi-language meta tags
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // TRANSLATE | |
| import { TranslateService, LangChangeEvent } from '@ngx-translate/core'; | |
| export class Component implements OnInit { | |
| constructor(public meta: Meta, public title: Title, public translate: TranslateService) {} | |
| ngOnInit(): void { | |
| this.translate.onLangChange.subscribe((event: LangChangeEvent) => { | |
| this.meta.updateTag( | |
| {name: 'description', content: this.translate.instant('META.HOME.DESCRIPTION')} | |
| ); | |
| this.title.setTitle(this.translate.instant('META.HOME.TITLE')); | |
| }); | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment