Autofocus

The autofocus (FocusOnLoad) directive is not included in this very package, but in the peerDependency @mintplayer/ng-focus-on-load. It focuses the elements (or even components that implement the focus() method) as soon as they appear, either through navigation or through *ngIf.

Basic usage

  
    
      
        <input type="text" name="name" autofocus>
        
    
  
    
      
        import { Component } from '@angular/core';
        
    
      
        import { FocusOnLoadDirective } from '@mintplayer/ng-focus-on-load';
        
    
      
        
        
    
      
        @Component({
        
    
      
          selector: 'my-autofocus-demo',
        
    
      
          templateUrl: './my-autofocus-demo.component.html',
        
    
      
          imports: [FocusOnLoadDirective],
        
    
      
        })
        
    
      
        export class MyAutofocusDemoComponent {}