Skip to content

Instantly share code, notes, and snippets.

View davidPardoC's full-sized avatar
🎯
Focusing

David Pardo davidPardoC

🎯
Focusing
View GitHub Profile
@rajaramtt
rajaramtt / trim-input.directive.ts
Created September 1, 2020 12:52
Angular Input Trim Directive
import { Directive, HostListener, OnInit, Optional } from '@angular/core';
import { NgControl } from '@angular/forms';
@Directive({
// tslint:disable-next-line:directive-selector
selector: 'input[trimInput],textarea[trimInput]',
})
export class TrimInputDirective implements OnInit {
constructor(@Optional() private ngControl: NgControl) {