(function () { 'use strict'; var app = angular.module('sysMgrApp'); app.directive('smFocus', [ '$timeout', function ($timeout) { return { restrict: 'A', scope: { noFocus: "=?" }, link: function (scope, element) { var noFocus = angular.isDefined(scope.noFocus) ? scope.noFocus : false; // console.log('noFocus=' + noFocus) if (!noFocus) { scope.$on('sm:focus', function () { $timeout(function () { element[0].focus(); }, 10); }); } } }; }]); })();The problem is that on the form with several tabs (tabs are on the left side), the first time the form opens the control has the focus. When I start switching between tabs, other tabs first control doesn't have focus (despite having that directive set) and when I go back to the original first tab the control also doesn't have focus anymore. I am wondering if there is a way to fix that behavior.