Horje
add fraction in angular Code Example
add fraction in 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...
      }
   }
}




Javascript

Related
invalidcharactererror: failed to execute 'atob' on 'window': the string to be decoded is not correctly encoded. Code Example invalidcharactererror: failed to execute 'atob' on 'window': the string to be decoded is not correctly encoded. Code Example
demo api url Code Example demo api url Code Example
tinymce-angular load slow Code Example tinymce-angular load slow Code Example
trim angular material input with ellipsis Code Example trim angular material input with ellipsis Code Example
is undefined false in javascript Code Example is undefined false in javascript Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7