Open Closed

How to hide the menu bar in identity server? #2761


User avatar
0
nhontran created

If you're creating a bug/problem report, please include followings:

  • ABP Framework version: v3.3.2
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

Hi, I would like to hide this identity server menu bar in staging and production by checking the environment

I have tried this but it does not work:

    Configure<AbpToolbarOptions>(options =>
    {
        var toolbar = options.Contributors.FirstOrDefault(x => x.GetType() == typeof(AccountModuleToolbarContributor));
        if (toolbar != null)
        {
            options.Contributors.Remove(toolbar);
        }
    });

any help would be appreciated.

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

1 Answer(s)
  • User Avatar
    0
    muhammedaltug created

    Hello

    Language selection, User menu and Full screen items added by theme lepton via NavItemsService

    You can remove these items using NavItemsService.

    Example:

    1. Declare a variable in environments which named environmentName
    // environment.ts
    export const environmentName = 'dev'
    
    // environment.prod.ts
    export const environmentName = 'prod'
    
    1. Inject NavItemsService in your app.component.ts and check your environment and delete item
    //app.component.ts
    import { Component } from '@angular/core';
    import { NavItemsService } from '@abp/ng.theme.shared';
    import { environmentName } from '../environments/environment';
    import { eThemeLeptonComponents } from '@volo/abp.ng.theme.lepton';
    @Component({
      selector: 'app-root',
      template: `
        &lt;abp-loader-bar&gt;&lt;/abp-loader-bar&gt;
        &lt;abp-dynamic-layout&gt;&lt;/abp-dynamic-layout&gt;
      `,
    })
    export class AppComponent {
      constructor(private navItems: NavItemsService) {
        // Check environment is prod
        if (environmentName.match('prod')) {
          navItems.removeItem(eThemeLeptonComponents.CurrentUser);
        }
      }
    }
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 16, 2026, 14:50
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.