'use strict'; /* http://docs-next.angularjs.org/api/angular.module.ng.$compileProvider.directive */ angular.module('Alias.directives', []). directive('navTabs', function($log) { var directiveDefinition = { restrict: 'C', link: function(scope, elm, attrs) { var tabs = elm.find('li'); var selectedTab = tabs.filter('.active'); if (!selectedTab.length) { selectedTab = tabs.filter(':first'); selectedTab.addClass('active'); } var selectedPane = $(selectedTab.find('a').attr('href')); selectedPane.addClass('active'); elm.on('click', function(event) { selectedTab.removeClass('active'); selectedPane.removeClass('active'); selectedTab = angular.element(event.target).parent(); selectedPane = $(selectedTab.find('a').attr('href')); selectedTab.addClass('active'); selectedPane.addClass('active'); event.preventDefault(); }); } }; return directiveDefinition; }).directive('dropdownToggle', function($log) { var directiveDefinition = { restrict: 'A', link: function(scope, elm, attrs) { elm.dropdown(); } }; return directiveDefinition; });