Aitor
Aitor

Reputation: 465

MeanJS - Add menu item without link

I'm using Full-Stack MeanJS and I want to add a menu item without link.

My code:

Menus.addMenuItem('sidebar', 'MyMenuItem', '', 'dropdown', '', false, ['admin'], 0, 'icon');

With this code the element "MyMenuItem" redirects me to root directory (home), do I have some way to completely remove the link?

Upvotes: 0

Views: 154

Answers (1)

Aitor
Aitor

Reputation: 465

I'll answer myself.

I had this in my html:

<a href="/#!/{{item.link}}" title="{{item.title | translate}}">
    <em ng-hide="inSubmenu" class="{{item.iconClass}}"></em>
    <span>{{item.title | translate}}</span>
</a>

And I changed it for a link without href attribute depending on my Menus.addMenuItem:

<a ng-if="item.menuItemType != 'dropdown'" href="/#!/{{item.link}}" title="{{item.title | translate}}">
    <em ng-hide="inSubmenu" class="{{item.iconClass}}"></em>
    <span>{{item.title | translate}}</span>
</a>
<a ng-if="item.menuItemType == 'dropdown'" title="{{item.title | translate}}">
    <em ng-hide="inSubmenu" class="{{item.iconClass}}"></em>
    <span>{{item.title | translate}}</span>
</a>

I hope it helps someone.

Upvotes: 0

Related Questions