Added pages to see, create, modify & delete redeemable actions. User card top right with disconnect & log out. Code clean up.
This commit is contained in:
14
src/app/shared/validators/item-exists-in-array.ts
Normal file
14
src/app/shared/validators/item-exists-in-array.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { AbstractControl, ValidationErrors, ValidatorFn } from "@angular/forms";
|
||||
|
||||
|
||||
export function createItemExistsInArrayValidator(items: any[], getter: (value: any) => any): ValidatorFn {
|
||||
return (control: AbstractControl): ValidationErrors | null => {
|
||||
const value = control.value;
|
||||
|
||||
if (!value)
|
||||
return null;
|
||||
|
||||
const matches = items.some(i => getter(i) == value);
|
||||
return matches ? { itemExistsInArray: true } : null;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user