summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/directives/file-upload
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-ui/src/app/directives/file-upload')
-rw-r--r--catalog-ui/src/app/directives/file-upload/file-upload.ts11
1 files changed, 6 insertions, 5 deletions
diff --git a/catalog-ui/src/app/directives/file-upload/file-upload.ts b/catalog-ui/src/app/directives/file-upload/file-upload.ts
index 4902741927..7d6667cbcc 100644
--- a/catalog-ui/src/app/directives/file-upload/file-upload.ts
+++ b/catalog-ui/src/app/directives/file-upload/file-upload.ts
@@ -94,13 +94,13 @@ export class FileUploadDirective implements ng.IDirective {
};
scope.onFileChange = ():void => {
+ if (scope.myFileModel || scope.fileModel) {
+ scope.fileModel = scope.myFileModel;
+ scope.formElement[scope.elementName].value = scope.myFileModel;
+ }
if (scope.onFileChangedInDirective) {
scope.onFileChangedInDirective();
}
- if (scope.myFileModel) {
- scope.fileModel = scope.myFileModel;
- scope.formElement[scope.elementName].$setValidity('required', true);
- }
};
scope.setEmptyError = (element):void => {
@@ -136,9 +136,10 @@ export class FileUploadDirective implements ng.IDirective {
};
scope.cancel = ():void => {
- scope.fileModel.filename = '';
+ scope.myFileModel = new FileUploadModel();
scope.formElement[scope.elementName].$pristine;
scope.formElement[scope.elementName].$setValidity('required', false);
+ scope.onFileChange();
}
};