SHARE
TWEET

Untitled

a guest Dec 18th, 2014 133 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   /** Wait for the next digest, then focus the first found tag of the type */
  2.   app.directive("focusFirst", function($timeout) {
  3.     return {
  4.       link: function(scope, elem, attrs) {
  5.         var selector = attrs.focusFirst || 'input';
  6.         $timeout(function() {
  7.           var found = elem.find(selector);
  8.           if (found[0]) found[0].focus();
  9.         });
  10.       }
  11.     }
  12.   });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top