Skip to content

Instantly share code, notes, and snippets.

View faisal6699's full-sized avatar

Faisal Ahmed faisal6699

View GitHub Profile
<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>
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(){}