Fixed error ''Cannot read property 'firstChild' of null'' after Login

This commit is contained in:
gpapavgeri 2020-08-27 17:38:07 +03:00
parent 3d9b30567d
commit 7a6228b136
1 changed files with 7 additions and 5 deletions

View File

@ -91,11 +91,13 @@ export class AppComponent implements OnInit {
filter(event => event instanceof NavigationEnd),
map(() => {
let child = this.route.firstChild;
while (child.firstChild) {
child = child.firstChild;
}
if (child.snapshot.data['title']) {
return child.snapshot.data['title'];
if (child != null) {
while (child.firstChild) {
child = child.firstChild;
}
if (child.snapshot.data['title']) {
return child.snapshot.data['title'];
}
}
return appTitle;
})