<commit_before>/* jshint unused: vars */

export default ['$route', '$rootScope', function($route, $rootScope) {
    return {
        require: '^^mainMenu',
        link: function(scope, element, attrs, mainMenuController) {
            var routeName = attrs.linkTo;

            scope.$on('$routeChangeStart', function() {
                // any time we start a route change,
                // assume it was from the menu, and
                // close it in case it's open
                mainMenuController.close();
            });

            scope.$on('$routeChangeSuccess', function(e, nextRoute) {
                if (nextRoute.$$route.name === routeName) {
                    element.addClass('MenuItem--active');
                } else {
                    element.removeClass('MenuItem--active');
                }
                return nextRoute.$$route.name;
            });

            scope.$on('$destroy', function() {
                element.off('click.menu-item');
            });

            element.on('click', function(e) {
                mainMenuController.close();
            }, true);

        }
    };
}];
<commit_msg>fixed route undefined console error<commit_after>/* jshint unused: vars */

export default ['$route', '$rootScope', function($route, $rootScope) {
    return {
        require: '^^mainMenu',
        link: function(scope, element, attrs, mainMenuController) {
            var routeName = attrs.linkTo;

            scope.$on('$routeChangeStart', function() {
                // any time we start a route change,
                // assume it was from the menu, and
                // close it in case it's open
                mainMenuController.close();
            });

            scope.$on('$routeChangeSuccess', function(e, nextRoute) {
                if (nextRoute.$$route && nextRoute.$$route.name === routeName) {
                    element.addClass('MenuItem--active');
                } else {
                    element.removeClass('MenuItem--active');
                }
                return nextRoute.$$route.name;
            });

            scope.$on('$destroy', function() {
                element.off('click.menu-item');
            });

            element.on('click', function(e) {
                mainMenuController.close();
            }, true);

        }
    };
}];

{'fraction_non_alphanumeric': 0.13615023474178403, 'fraction_numerical': 0.0, 'mean_word_length': 1.5258620689655173, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1555671', 'n_tokens_mistral': 597, 'n_tokens_neox': 561, 'n_words': 129}