summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report-form-fields/remove-space.directive.ts
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report-form-fields/remove-space.directive.ts')
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report-form-fields/remove-space.directive.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report-form-fields/remove-space.directive.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report-form-fields/remove-space.directive.ts
new file mode 100644
index 00000000..5bc8058d
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report-form-fields/remove-space.directive.ts
@@ -0,0 +1,18 @@
+import {Directive, ElementRef, HostListener} from '@angular/core';
+
+@Directive({
+ selector: '[appRemoveSpace]'
+})
+export class RemoveSpaceDirective {
+
+ constructor(private _el: ElementRef) { }
+
+ @HostListener('textarea', ['$event']) onInputChange(event) {
+ const initialValue = this._el.nativeElement.value;
+ this._el.nativeElement.value = initialValue.toString().trim();
+ if ( initialValue !== this._el.nativeElement.value) {
+ event.stopPropagation();
+ }
+ }
+
+}