{"size": 612, "ext": "js", "max_stars_repo_path": "modules/ui/app/scripts/directives/SetFocusDirective.js", "max_stars_repo_name": "LuShengDong/wasabi", "max_stars_repo_stars_event_min_datetime": "2016-06-21T22:05:38.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T17:00:41.000Z", "max_issues_repo_path": "modules/ui/app/scripts/directives/SetFocusDirective.js", "max_issues_repo_name": "LuShengDong/wasabi", "max_issues_repo_issues_event_min_datetime": "2016-06-27T22:49:06.000Z", "max_issues_repo_issues_event_max_datetime": "2021-12-09T19:44:43.000Z", "max_forks_repo_path": "modules/ui/app/scripts/directives/SetFocusDirective.js", "max_forks_repo_name": "LuShengDong/wasabi", "max_forks_repo_forks_event_min_datetime": "2016-06-27T22:10:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-15T08:53:11.000Z"}
{"max_stars_count": 1109, "max_issues_count": 344, "max_forks_count": 273, "avg_line_length": 36.0, "max_line_length": 99, "alphanum_fraction": 0.5032679739}
'use strict';

angular.module('wasabi.directives').directive('setFocus',
    function () {
        return {
            restrict: 'A',
            link: function (scope, element, attrs) {
                // The attribute "watch-element" is the name of a property in the scope that will
                // be updated to put the focus on the element.  Just make it an integer and add one
                // each time you want to force the focus.
                scope.$watch(attrs.watchElement,
                function () {
                    element.focus();
                });
            }
        };
    });