I'm trying to reach a function that I created in a seperate typescript file but I feel like I'm missing something because it's not working, maybe some routing?
My inputfield: (inside groepdef-edit-component.html)
<input type="number" (blur)="Utils.SetTariefIfEmpty($event)"
I imported the export class Utils
My typescript file: (inside groepdef.edit.component.ts)
import { Utils } from '../Utils/Utils';
My Seperate TS file:
import { Component } from '@angular/core';
@Component({
selector: 'app-utils',
templateUrl: './groeperingdefinitie-contract-edit.component.html',
})
export class Utils {
public static SetTariefIfEmpty(event: any): void {
if (event === undefined || event === null) {
return;
}
if (event.target !== undefined && event.target !== null) {
if (event.target.value.length == 0) {
event.target.value = 0;
}
}
}
}