in src/app/accounting/journalEntries/form/transaction-type-select/validator/transaction-type-exists.validator.ts [28:42]
export function transactionTypeExists(accountingService: AccountingService): AsyncValidatorFn {
return (control: AbstractControl): Observable<any> => {
if (!control.dirty || isEmptyInputValue(control.value)) {
return Observable.of(null);
}
if (isString(control.value) && control.value.trim().length === 0) {
return invalid;
}
return accountingService.findTransactionType(control.value, true)
.map(account => null)
.catch(() => invalid);
};
}