Created
September 20, 2019 12:44
-
-
Save CharlieGreenman/4419a0aaef17a43d04ddd7d6c6d019b0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { FormGroup, ValidationErrors, ValidatorFn } from '@angular/forms'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class LoanAmountValidatorService { | |
constructor() { } | |
identityRevealedValidator: ValidatorFn = (formGroup: FormGroup): ValidationErrors | null => { | |
const income = formGroup.get('income'); | |
const expenses = formGroup.get('expenses'); | |
return income && expenses && income.value - expenses.value > 100000 ? { 'loanAmount': true } : null; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment