1(function() { 2 'use strict'; 3 angular 4 .module('autofocus', []) 5 .directive('autofocus', ['$parse','$timeout', Autofocus]); 6 7 function Autofocus($parse, $timeout) { 8 function link($scope, $element, $attrs) { 9 var dom = $element[0], 10 delay = $attrs.autofocusDelay; 11 12 if ($attrs.autofocus) { 13 focusIf($parse($attrs.autofocus)($scope)); 14 $scope.$watch($attrs.autofocus, focusIf); 15 } else { 16 focusIf(true); 17 } 18 19 function focusIf(condition) { 20 delay = delay || 0; 21 if (condition) { 22 $timeout(function() { 23 dom.focus(); 24 }, delay); 25 } 26 } 27 } 28 29 return { 30 restrict: 'A', 31 link: link 32 }; 33 } 34})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.