Language switch is working.
This commit is contained in:
parent
0f9a1729b3
commit
bb4e3e51c0
@ -26,19 +26,29 @@ export class LanguagetoggleComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.stateService.getLanguageFromRoute(this.route).subscribe(lang => {
|
this.stateService.getLanguageFromRoute(this.route).subscribe(lang => {
|
||||||
console.log('languagetoggle gets this language: ' + lang);
|
if(lang==null) {
|
||||||
console.log('(' + this.language + ')')
|
console.log('language is null from first level route, ignoring');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log('languagetoggle gets first level lang: '+lang);
|
||||||
if (lang === this.language) {
|
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;
|
this.show = true;
|
||||||
|
} else {
|
||||||
|
this.show = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.stateService.getLanguageFromRoute(this.route.parent).subscribe(lang => {
|
this.stateService.getLanguageFromRoute(this.route.parent).subscribe(lang => {
|
||||||
console.log('languagetoggle gets this language from parent: ' + lang);
|
if(lang==null) {
|
||||||
console.log('(' + this.language + ')')
|
console.log('language is null from parent level route, ignoring');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log('languagetoggle gets parent level lang: '+lang);
|
||||||
if (lang === this.language) {
|
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;
|
this.show = true;
|
||||||
|
} else {
|
||||||
|
this.show = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,7 +23,7 @@ export class RootComponent implements OnInit {
|
|||||||
console.log('oninit of root component');
|
console.log('oninit of root component');
|
||||||
this.route.paramMap.subscribe(val => console.log(val));
|
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 => {
|
this.pageType$ = this.stateService.getLanguageFromRoute(this.route).map(language => {
|
||||||
if (this.router.url.endsWith('posts')) {
|
if (this.router.url.endsWith('posts')) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user