Module: MainMenu

MainMenu

Main menu with marking of currently active menu-entry. The menu can be nested (maximum 3 levels) with automatic expand/fold functionality.

The optional property toggleBroadcast is used to execute events from the $rootScope. For example if the menu is inside an opened sidebar the event is used to close the sidebar (if the current path-route is the same as in the clicked link).

Author:
  • Jan Uhlmann <jan.uhlmann (at) kiwigrid.com>
Source:

Examples

<div data-keta-main-menu data-configuration="menuConfiguration" data-title-callback="getAppTitle"></div>
angular.module('exampleApp', ['keta.directives.MainMenu', 'keta.directives.Sidebar'])
    .controller('ExampleController', function($scope, ketaSidebarConfig) {

        // menu object to use as input for directive
        $scope.menuConfiguration = {
            items: [{
                name: 'Dashboard',
                link: '/dashboard',
                icon: 'signal'
            }, {
                name: 'Applications',
                icon: 'th-large',
                items: [{
                    name: 'Application 1',
                    link: '/applications/1'
                }, {
                    name: 'All Apps',
                    items: [{
                        name: 'Application 2',
                        link: '/applications/2'
                    }, {
                        name: 'Application 3',
                        link: '/applications/3'
                    }]
                }]
            }],
            compactMode: false,
            toggleBroadcast: ketaSidebarConfig.EVENT.TOGGLE_SIDEBAR_LEFT
        };

        // return app-title depending on current language
        $scope.getAppTitle = function() {
            return 'My App';
        };

    });