This file contains 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
<div class="form-group"> | |
<input id="password" capsLockDetect (capsLockOn)="capsLock = $event" type="password"> | |
<small class="form-text text-muted">Password</small > | |
<strong class="capslock-warning" title="Caps-lock is ON!" *ngIf="capsLock === 1"> | |
Caps-lock is ON! | |
</strong> | |
</div> |
This file contains 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
import {Directive, OnInit, HostListener, Output, EventEmitter} from "@angular/core"; | |
@Directive({ | |
selector: '[capsLockDetect]' | |
}) | |
export class CapsLockDetectDirective implements OnInit{ | |
@Output() capsLockOn = new EventEmitter<number>(); | |
capslock:number = 0; | |
constructor(){} |