Base solution for your next web application
Open Closed

External link in menu and New entry point #4508


User avatar
0
joe704la created

I was wondering can I add an external link to the AppMenuItem?

Also how would I set a new entry point into the site? I do not want the dashboard or the notifications to be the entry point for non admins.

Thank you


3 Answer(s)
  • User Avatar
    0
    strix20 created

    I don't think external links are supported. I have a separate issue due to the current constraints of the menu system, see here:

    #4459

    Perhaps it would be of use to request enhancements to the constricting menu system on github?

  • User Avatar
    0
    joe704la created

    I ended up adding a external boolean to the AppMenuItem class

    export class AppMenuItem {
        name = '';
        permissionName = '';
        icon = '';
        route = '';
        items: AppMenuItem[];
        external: boolean;
    
        constructor(name: string, permissionName: string, icon: string, route: string, external?: boolean, items?: AppMenuItem[]) {
            this.name = name;
            this.permissionName = permissionName;
            this.icon = icon;
            this.route = route;
            this.external = external;
    
            if (items === undefined) {
                this.items = [];
            } else {
                this.items = items;
            }
        }
    }
    

    Then in the side-bar-menu.component.html I added this

    <a href="{{menuItem.route}}" *ngIf="!menuItem.items.length && menuItem.external" class="m-menu__link m-menu__toggle" target="_blank">
                        <i class="m-menu__link-icon {{menuItem.icon}}"></i>
                        <span class="m-menu__link-text">
                            <span class="title">{{l(menuItem.name)}}</span>
                        </span>
                    </a>
    

    It seems to work very well. I just had a need to link to two different external applications.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks @joe704la, we will also include this into AspNet Zero, <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/733">https://github.com/aspnetzero/aspnet-ze ... issues/733</a>.