(function(){ 'use strict'; angular.module('sbAdminApp') .run(['$templateCache', function ($templateCache) { $templateCache.put('partials/menu-link.tmpl.html', '\n' + ' {{section.icon}}\n' + ' {{section.name}}\n' + ' \n' + ' current page\n' + ' \n' + '\n' + ''); }]) .directive('menuLink', function () { return { scope: { section: '=' }, templateUrl: 'partials/menu-link.tmpl.html', link: function ($scope, $element) { var controller = $element.parent().controller(); $scope.focusSection = function () { // set flag to be used later when // $locationChangeSuccess calls openPage() controller.autoFocusContent = true; }; } }; }) })();