We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

New Sidebar

I have a application level sidebar.   Now, How do I have at page level override that with a page level sidebar?  Which means that I want to disable the app level sidebar and replace that with a page level sidebar.   Can this be done?  Thank you.

1 Reply

DL Deepa Loganathan Syncfusion Team January 9, 2019 05:21 PM UTC

Hi Albert, 
 
Thanks for contacting Syncfusion support. 
 
We understood your requirement to show different Sidebars in the main page and subpages of your application.   
 
In a Single page application, this can be achieved by showing or hiding the Sidebars in the routing event of your application, wherein the sidebars will be shown or hidden in the Angular router navigation events. 
 
We have prepared a sample based on your requirement. Please check the below Stackblitz link. 
 
 
In the attached sample, we have achieved your requirement using the Angular Router event NavigationEnd and the ngAfterViewChecked life hook method. 
 
[app.component.ts] 
export class AppComponent implements AfterViewChecked { 
  @ViewChild('sidebar') 
  public side: SidebarComponent; 
  public urlValue: String; 
  title = 'Synfusion Sidebar'; 
  constructor(router: Router) { 
    router.events.forEach((event) => { 
      if (event instanceof NavigationEnd) { 
        this.urlValue = event.url; 
      } 
    }); 
  } 
  ngAfterViewChecked() { 
    if (this.urlValue !== "/") { 
      this.side.hide(); 
    } else { 
      this.side.show(); 
    } 
  } 
} 
 
 
Regards, 
Deepa L. 
 


Loader.
Live Chat Icon For mobile
Up arrow icon