From d2a05db2e320bc0f60485c1f9bacedcc704cd4bb Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Mon, 28 Mar 2022 12:14:16 +0300 Subject: [PATCH] Fix max-height in select input when value is null --- sharedComponents/input/input.component.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sharedComponents/input/input.component.ts b/sharedComponents/input/input.component.ts index 6b16d826..b853fa7b 100644 --- a/sharedComponents/input/input.component.ts +++ b/sharedComponents/input/input.component.ts @@ -15,7 +15,6 @@ import { import {AbstractControl, FormArray, FormControl, ValidatorFn} from "@angular/forms"; import {HelperFunctions} from "../../utils/HelperFunctions.class"; import {Observable, of, Subscription} from "rxjs"; -import {MatSelect} from "@angular/material/select"; import {MatAutocompleteSelectedEvent} from "@angular/material/autocomplete"; import {map, startWith} from "rxjs/operators"; import {MatChipInputEvent} from "@angular/material/chips"; @@ -283,7 +282,9 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang ngAfterViewInit() { /** If options are available set max-height base on input-wrapper height */ if(this.options && this.options.length > 1) { - this.elementRef.nativeElement.style.maxHeight = this.inputBox.nativeElement.clientHeight + 'px'; + setTimeout(() => { + this.elementRef.nativeElement.style.maxHeight = this.inputBox.nativeElement.clientHeight + 'px'; + }, 0); } this.reset(); } @@ -342,6 +343,8 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang } if (this.initValue === value || (this.initValue === '' && value === null)) { this.formControl.markAsPristine(); + } else { + this.formControl.markAsDirty(); } if (this.searchControl) { this.searchControl.setValue(null);