Created
          July 20, 2013 10:48 
        
      - 
      
- 
        Save EpokK/6044633 to your computer and use it in GitHub Desktop. 
    ngFocus
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | myApp.directive('ngFocus', function( $timeout ) { | |
| return function( scope, elem, attrs ) { | |
| scope.$watch(attrs.ngFocus, function( newval ) { | |
| if ( newval ) { | |
| $timeout(function() { | |
| elem[0].focus(); | |
| }, 0, false); | |
| } | |
| }); | |
| }; | |
| }); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Necessite jQuery