From 0561d945c55068dc9297f83cf7caff1eb7b0b97b Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Tue, 8 Feb 2022 11:52:11 +0200 Subject: [PATCH] Fix dashboard input being disable in HTML --- sharedComponents/input/input.component.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sharedComponents/input/input.component.ts b/sharedComponents/input/input.component.ts index d33aa0b5..333c563b 100644 --- a/sharedComponents/input/input.component.ts +++ b/sharedComponents/input/input.component.ts @@ -1,4 +1,5 @@ import { + AfterViewInit, Component, ElementRef, EventEmitter, @@ -171,7 +172,7 @@ export interface Option { `, styleUrls: ['input.component.css'] }) -export class InputComponent implements OnInit, OnDestroy, OnChanges { +export class InputComponent implements OnDestroy, AfterViewInit, OnChanges { /** Basic information */ @Input('formInput') formControl: AbstractControl; @Input('type') type: 'text' | 'URL' | 'logoURL' | 'autocomplete' | 'textarea' | 'select' | 'checkbox' | 'chips' = 'text'; @@ -225,7 +226,7 @@ export class InputComponent implements OnInit, OnDestroy, OnChanges { this.focusEmitter.emit(this.focused); } - ngOnInit(): void { + ngAfterViewInit() { this.reset(); } @@ -279,6 +280,9 @@ export class InputComponent implements OnInit, OnDestroy, OnChanges { if (!this.formControl.value) { this.formControl.setValue((this.type === "checkbox")?false:''); } + if(this.input) { + this.input.nativeElement.disabled = this.formControl.disabled; + } } unsubscribe() {