0

So I want the header and footer to disappear for the following slugs. It's working perfectly but I am not going with a dynamic approach I hard code all the slugs where I don't want to show the header and footer. here is the code.

  showHead = true;
   showFoot = true;
   constructor(private router: Router) {
     // on Route change to '/admin', set the variable showHead to false
     router.events.forEach((event) => {
       if (event instanceof NavigationStart) {
         if (
           event.url == '/admin' || 
           event.url == '/admin/CreateCard' || 
           event.url == '/admin/CardAnalytics' || 
           event.url == '/admin/dashboard'|| 
           event.url== '/admin/CreateFeatureCard' || 
           event.url=='/admin/Settings' || 
           event.url=='/admin/FeatureCardAnalytics' || 
           event.url == '/superAdmin' || 
           event.url == '/superAdmin/dummy' ||
           event.url == '/user' ||
           event.url == '/user/userDashboard'
           ) { this.showHead = false; this.showFoot = false; } else {
             this.showHead = true;
             this.showFoot = true;
           }
       }
     });

}

Now My Question: I want an approach instead of writing all the slugs I want to use an approach that is /admin/(after this slash any slug will come then don't show head or foot). Do I need to do this /admin/* or something else Please help me. Regards

Useme Alehosaini
  • 2,998
  • 6
  • 18
  • 26
work space
  • 62
  • 9

0 Answers0