aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/components/formControls/component/file/file.formControl.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'vid-webpack-master/src/app/shared/components/formControls/component/file/file.formControl.component.ts')
-rw-r--r--vid-webpack-master/src/app/shared/components/formControls/component/file/file.formControl.component.ts27
1 files changed, 27 insertions, 0 deletions
diff --git a/vid-webpack-master/src/app/shared/components/formControls/component/file/file.formControl.component.ts b/vid-webpack-master/src/app/shared/components/formControls/component/file/file.formControl.component.ts
new file mode 100644
index 000000000..2c2172005
--- /dev/null
+++ b/vid-webpack-master/src/app/shared/components/formControls/component/file/file.formControl.component.ts
@@ -0,0 +1,27 @@
+import {Component, ElementRef, Input, ViewChild} from "@angular/core";
+import {FormGroup} from "@angular/forms";
+import {FileFormControl} from "../../../../models/formControlModels/fileFormControl.model";
+
+@Component({
+ selector : 'file-form-control',
+ templateUrl : './file.formControl.component.html',
+ styleUrls : ['./file.formControl.component.scss']
+})
+
+export class FileFormControlComponent {
+ @Input() data: FileFormControl = null;
+ @Input() form: FormGroup;
+ @ViewChild('fileUploader')
+ fileUploader:ElementRef ;
+
+ onDelete(event, data, form) {
+ event.stopPropagation();
+ event.preventDefault();
+ form.value[data.controlName] = this.fileUploader.nativeElement.value = "";
+ data.selectedFile = data.placeHolder;
+ if (data.onDelete){
+ data.onDelete(form);
+ }
+
+ }
+}