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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

New Sidebar

Thread ID:

Created:

Updated:

Platform:

Replies:

141833 Jan 7,2019 08:38 AM UTC Jan 9,2019 05:21 PM UTC Angular - EJ 2 1
loading
Tags: Sidebar
Albert K
Asked On January 7, 2019 08:38 AM UTC

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.

Deepa Loganathan [Syncfusion]
Replied On 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. 
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;