Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dynamic Focus
Message
De
29/07/2014 04:59:35
 
 
Information générale
Forum:
Javascript
Catégorie:
Autre
Titre:
Divers
Thread ID:
01604694
Message ID:
01604864
Vues:
36
>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 ?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform