summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src/app/Directives
diff options
context:
space:
mode:
Diffstat (limited to 'usecaseui-portal/src/app/Directives')
-rw-r--r--usecaseui-portal/src/app/Directives/disable-control.directive.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/usecaseui-portal/src/app/Directives/disable-control.directive.ts b/usecaseui-portal/src/app/Directives/disable-control.directive.ts
new file mode 100644
index 00000000..85495401
--- /dev/null
+++ b/usecaseui-portal/src/app/Directives/disable-control.directive.ts
@@ -0,0 +1,17 @@
+import { Directive, Input } from '@angular/core';
+import { NgControl } from '@angular/forms';
+
+@Directive({
+ selector: '[disableControl]'
+})
+export class DisableControlDirective {
+
+ @Input()
+ set disableControl(condition: boolean) {
+ const action = condition ? 'enable' : 'disable';
+ this.ngControl.control[action]();
+ }
+
+ constructor(private ngControl: NgControl) {
+ }
+} \ No newline at end of file