All Downloads are FREE. Search and download functionalities are using the official Maven repository.

src.app.shared.directives.input-focus.directive.ts Maven / Gradle / Ivy

The newest version!
/*
 * SPDX-FileCopyrightText: 2017-2024 Enedis
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 */

import { Directive, ElementRef, OnInit, Renderer2 } from '@angular/core';

@Directive({
    selector : '[chutneyFocusOnShow]'
  })
export class InputFocusDirective implements OnInit {
    constructor(public renderer: Renderer2, public elementRef: ElementRef) {}

    ngOnInit() {
      this.renderer.selectRootElement(this.elementRef.nativeElement).focus();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy