Skip to content

Instantly share code, notes, and snippets.

JavaScript ♥

José Veiga JoseRubensVeiga

JavaScript ♥
  • São Paulo, SP
Block or report user

Report or block JoseRubensVeiga

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
JoseRubensVeiga / number-only.directive.ts
Created Feb 3, 2020 — forked from pardamike/number-only.directive.ts
Angular 6 Directive to allow only positive integers in an input
View number-only.directive.ts
// *** NOTE: This is only allowing positive integers, adjust the regex to suit your needs
// Stackblitz (w/ Angular Material):
import { Directive, ElementRef, HostListener } from '@angular/core';
selector: '[numberOnly]'
export class NumberOnlyDirective {
// Only want positive integers
You can’t perform that action at this time.