diff --git a/src/app/app.component.html b/src/app/app.component.html index 1e157542a676000642a2a0d17eda16eb0c85cc41..2471e3c3062c1d55fab6bbde9c307a8351f30211 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,2 +1,2 @@ -<app-header></app-header> +<app-header *ngIf="!playQuiz"></app-header> <router-outlet></router-outlet> diff --git a/src/app/app.component.ts b/src/app/app.component.ts index ad4958d7fb0b3509bfdb38d2d5612655f0b6a1d1..7ac1d11fcd9e8088ec62e20ed469466648e59d05 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,8 +1,20 @@ -import { Component } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute, ActivatedRouteSnapshot, NavigationEnd, Router } from '@angular/router'; +import { filter } from 'rxjs'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrl: './app.component.css', }) -export class AppComponent {} +export class AppComponent implements OnInit { + playQuiz: boolean = false; + + constructor(private router: Router, private route: ActivatedRoute) {} + + ngOnInit(): void { + this.router.events.pipe(filter((event) => event instanceof NavigationEnd)).subscribe(() => { + this.playQuiz = this.router.url.includes('play-quiz'); + }); + } +}