Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dynamic Focus
Message
 
 
General information
Forum:
Javascript
Category:
Other
Title:
Miscellaneous
Thread ID:
01604694
Message ID:
01604847
Views:
37
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.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform