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

image.png

I have tried this but it does not work:

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

any help would be appreciated.


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: `
        <abp-loader-bar></abp-loader-bar>
        <abp-dynamic-layout></abp-dynamic-layout>
      `,
    })
    export class AppComponent {
      constructor(private navItems: NavItemsService) {
        // Check environment is prod
        if (environmentName.match('prod')) {
          navItems.removeItem(eThemeLeptonComponents.CurrentUser);
        }
      }
    }
    
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.2.0-preview. Updated on March 13, 2025, 04:08