Agregar fracción en angular

@Directive({
   selector: '[exampleDirective]'
})
export class TestDirective {

   constructor() {}

   @HostListener('input', ['$event'])
   ngOnChanges(evt: any) {
      const pattern: RegExp = new RegExp(/^[0-9]+\.?[0-9]*$/);
      if (!pattern.test(evt.target.value)) {
         evt.srcElement.value = evt.srcElement.value.substring(0, evt.srcElement.value.length - 1); // this will erase the last char that does not match the pattern...
      }
   }
}
Homeless Heron