(function() {
    'use strict';

    angular
        .module('app.layout.topnavmenu')
        .factory('menuhelper', menuhelper);

    menuhelper.$inject = ['$location', '$rootScope', '$state', 'logger'];

    function menuhelper($location, $rootScope, $state, logger) {
        // var handlingRouteChangeError = false;
        // var routeCounts = {
        //     errors: 0,
        //     
        //     changes: 0
        //     
        // };
        var _menus = [];
        // var $routeProvider = routeHelperConfig.config.$routeProvider;

        var service = {
            configureMenus: configureMenus,
            getMenus: getMenus/*,
            //menuCounts: menuCounts
            //*/
        };

        //init();

        return service;
        ///////////////

        /**
         * [configureMenus add menu]
         *
         * @param  {String} component component which menu is being configured
         *                            (should be the same as title of the title element set in config.route.js
         *                            TODO : maybe create a module constant that could be used for this
         * @param  {Array} menus      menu description
         *
         * @return {[type]}           [description]
         */
        function configureMenus(component, menus) {
            _menus.push({'component':component, 'menus': menus});
        }
        /*
        function handleRoutingErrors() {
            // Route cancellation:
            // On routing error, go to the dashboard.
            // Provide an exit clause if it tries to do it twice.
            $rootScope.$on('$routeChangeError',
                function(event, current, previous, rejection) {
                    if (handlingRouteChangeError) {
                        return;
                    }
                    routeCounts.errors++;
                    handlingRouteChangeError = true;
                    var destination = (current && (current.title || current.name || current.loadedTemplateUrl)) ||
                        'unknown target';
                    var msg = 'Error routing to ' + destination + '. ' + (rejection.msg || '');
                    logger.warning(msg, [current]);
                    $location.path('/');
                }
            );
        }

        function init() {
            handleRoutingErrors();
            updateDocTitle();
        }
        */
        /**
         * [getMenus get all configured menus]
         *
         * @return {[type]} [description]
         */
        function getMenus() {
            // for (var prop in $route.routes) {
            //     if ($route.routes.hasOwnProperty(prop)) {
            //         var route = $route.routes[prop];
            //         var isRoute = !!route.title;
            //         if (isRoute) {
            //             routes.push(route);
            //         }
            //     }
            // }
            return _menus;
        }

        // function updateDocTitle() {
        //     $rootScope.$on('$routeChangeSuccess',
        //         function(event, current, previous) {
        //             routeCounts.changes++;
        //             handlingRouteChangeError = false;
        //             var title = routeHelperConfig.config.docTitle + ' ' + (current.title || '');
        //             $rootScope.title = title; // data bind to <title>
        //         }
        //     );
        // }
    }
})();

@@ -276,276 +276,24 @@
     
-// var handlingRouteChangeError = false;%0A        // var routeCounts = %7B%0A        //     errors: 0,%0A        //     %0A        //     changes: 0%0A        //     %0A        // %7D;%0A        var _menus = %5B%5D;%0A        // var $routeProvider = routeHelperConfig.config.$routeProvider;%0A
+var _menus = %5B%5D;
 %0A   
@@ -391,94 +391,18 @@
 enus
-/*,%0A            //menuCounts: menuCounts%0A            //*/%0A        %7D;%0A%0A        //init()
+%0A        %7D
 ;%0A%0A 
@@ -1065,1029 +1065,8 @@
   %7D%0A
-        /*%0A        function handleRoutingErrors() %7B%0A            // Route cancellation:%0A            // On routing error, go to the dashboard.%0A            // Provide an exit clause if it tries to do it twice.%0A            $rootScope.$on('$routeChangeError',%0A                function(event, current, previous, rejection) %7B%0A                    if (handlingRouteChangeError) %7B%0A                        return;%0A                    %7D%0A                    routeCounts.errors++;%0A                    handlingRouteChangeError = true;%0A                    var destination = (current && (current.title %7C%7C current.name %7C%7C current.loadedTemplateUrl)) %7C%7C%0A                        'unknown target';%0A                    var msg = 'Error routing to ' + destination + '. ' + (rejection.msg %7C%7C '');%0A                    logger.warning(msg, %5Bcurrent%5D);%0A                    $location.path('/');%0A                %7D%0A            );%0A        %7D%0A%0A        function init() %7B%0A            handleRoutingErrors();%0A            updateDocTitle();%0A        %7D%0A        */
 %0A   
@@ -1622,485 +1622,8 @@
    %7D
-%0A%0A        // function updateDocTitle() %7B%0A        //     $rootScope.$on('$routeChangeSuccess',%0A        //         function(event, current, previous) %7B%0A        //             routeCounts.changes++;%0A        //             handlingRouteChangeError = false;%0A        //             var title = routeHelperConfig.config.docTitle + ' ' + (current.title %7C%7C '');%0A        //             $rootScope.title = title; // data bind to %3Ctitle%3E%0A        //         %7D%0A        //     );%0A        // %7D
 %0A   

remove comments