mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 07:23:03 +00:00
added tests and typedoc
This commit is contained in:
@@ -13,6 +13,9 @@ import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms';
|
||||
{ provide: NG_VALUE_ACCESSOR, useExisting: FileValueAccessorDirective, multi: true }
|
||||
]
|
||||
})
|
||||
/**
|
||||
* Value accessor directive for inputs of type 'file'
|
||||
*/
|
||||
export class FileValueAccessorDirective implements ControlValueAccessor {
|
||||
value: any;
|
||||
onChange = (_) => { /* empty */ };
|
||||
|
@@ -8,9 +8,12 @@ import {NG_VALIDATORS, Validator, FormControl} from '@angular/forms';
|
||||
{ provide: NG_VALIDATORS, useExisting: FileValidator, multi: true },
|
||||
]
|
||||
})
|
||||
/**
|
||||
* Validator directive to validate if a file is selected
|
||||
*/
|
||||
export class FileValidator implements Validator {
|
||||
static validate(c: FormControl): {[key: string]: any} {
|
||||
return c.value == null || c.value.length === 0 ? { required : true} : null;
|
||||
return c.value == null || c.value.length === 0 ? { required : true } : null;
|
||||
}
|
||||
|
||||
validate(c: FormControl): {[key: string]: any} {
|
||||
|
Reference in New Issue
Block a user