All Downloads are FREE. Search and download functionalities are using the official Maven repository.

webapp.scripts.components.navbar.navbar.directive.js Maven / Gradle / Ivy

Go to download

Highly-available version-controlled service configuration repository based on Git, ZooKeeper and HTTP/2 (centraldogma-server)

There is a newer version: 0.70.0
Show newest version
'use strict';

angular.module('CentralDogmaAdmin')
    .directive('activeMenu', function ($translate, $locale, tmhDynamicLocale) {
                 return {
                   restrict: 'A',
                   link: function (scope, element, attrs) {
                     var language = attrs.activeMenu;

                     scope.$watch(function () {
                       return $translate.use();
                     }, function (selectedLanguage) {
                       if (language === selectedLanguage) {
                         tmhDynamicLocale.set(language);
                         element.addClass('active');
                       } else {
                         element.removeClass('active');
                       }
                     });
                   }
                 };
               })
    .directive('activeLink', function (location) {
                 return {
                   restrict: 'A',
                   link: function (scope, element, attrs) {
                     var clazz = attrs.activeLink;
                     var path = attrs.href;
                     path = path.substring(1); //hack because path does bot return including hashbang
                     scope.location = location;
                     scope.$watch('location.path()', function (newPath) {
                       if (path === newPath) {
                         element.addClass(clazz);
                       } else {
                         element.removeClass(clazz);
                       }
                     });
                   }
                 };
               });




© 2015 - 2024 Weber Informatics LLC | Privacy Policy