>Here is the directive with my new changes:
>
>
>(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.
Not sure. I guess you could watch for click on the tab and reset focus there ?