diff --git a/src/app/components/languagetoggle/languagetoggle.component.ts b/src/app/components/languagetoggle/languagetoggle.component.ts index 61b4c0c..7c3bfa7 100644 --- a/src/app/components/languagetoggle/languagetoggle.component.ts +++ b/src/app/components/languagetoggle/languagetoggle.component.ts @@ -26,19 +26,29 @@ export class LanguagetoggleComponent implements OnInit { ngOnInit() { this.stateService.getLanguageFromRoute(this.route).subscribe(lang => { - console.log('languagetoggle gets this language: ' + lang); - console.log('(' + this.language + ')') + if(lang==null) { + console.log('language is null from first level route, ignoring'); + return; + } + console.log('languagetoggle gets first level lang: '+lang); if (lang === this.language) { - console.log('equalled (first level of route)! showing the component'); + console.log('equalled (first level of route)! showing the component' + this.language); this.show = true; + } else { + this.show = false; } }); this.stateService.getLanguageFromRoute(this.route.parent).subscribe(lang => { - console.log('languagetoggle gets this language from parent: ' + lang); - console.log('(' + this.language + ')') + if(lang==null) { + console.log('language is null from parent level route, ignoring'); + return; + } + console.log('languagetoggle gets parent level lang: '+lang); if (lang === this.language) { - console.log('equalled (parent level of route)! showing the component'); + console.log('equalled (parent level of route)! showing the component ' + this.language); this.show = true; + } else { + this.show = false; } }); } diff --git a/src/app/components/root/root.component.ts b/src/app/components/root/root.component.ts index 472fe56..a00456f 100644 --- a/src/app/components/root/root.component.ts +++ b/src/app/components/root/root.component.ts @@ -23,7 +23,7 @@ export class RootComponent implements OnInit { console.log('oninit of root component'); this.route.paramMap.subscribe(val => console.log(val)); - this.stateService.getLanguageFromRoute(this.route).subscribe(val => {console.log('ngoninit root' + val)}); + this.stateService.getLanguageFromRoute(this.route).subscribe(val => {console.log('ngoninit root language: ' + val)}); this.pageType$ = this.stateService.getLanguageFromRoute(this.route).map(language => { if (this.router.url.endsWith('posts')) {