mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
Fix #4891 Kundendaten erfassen // Land bei Lieferung nicht auswählbar
This commit is contained in:
@@ -46,6 +46,7 @@ export class SelectOptionComponent<T = any> implements FocusableOption {
|
||||
select(event: Event): void {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
console.log('SelectOptionComponent.select', this.value, this._onSelect);
|
||||
this._onSelect(this.value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import {
|
||||
HostListener,
|
||||
ElementRef,
|
||||
HostBinding,
|
||||
AfterContentInit,
|
||||
OnDestroy,
|
||||
} from '@angular/core';
|
||||
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
||||
@@ -20,7 +19,6 @@ import { SelectOptionComponent } from './select-option.component';
|
||||
import { IconComponent } from '@shared/components/icon';
|
||||
import { BaseFormControlDirective } from '@shared/components/form-control';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { NgIf } from '@angular/common';
|
||||
|
||||
@Component({
|
||||
@@ -34,7 +32,7 @@ import { NgIf } from '@angular/common';
|
||||
imports: [IconComponent, NgIf],
|
||||
providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: SelectComponent, multi: true }],
|
||||
})
|
||||
export class SelectComponent<T = any> extends BaseFormControlDirective implements ControlValueAccessor, AfterContentInit, OnDestroy {
|
||||
export class SelectComponent<T = any> extends BaseFormControlDirective implements ControlValueAccessor, OnDestroy {
|
||||
@ContentChildren(SelectOptionComponent)
|
||||
options: QueryList<SelectOptionComponent>;
|
||||
|
||||
@@ -101,16 +99,6 @@ export class SelectComponent<T = any> extends BaseFormControlDirective implement
|
||||
super();
|
||||
}
|
||||
|
||||
ngAfterContentInit() {
|
||||
this.options.changes.pipe(takeUntil(this._onDestroy$)).subscribe(() => {
|
||||
this.options.forEach((option) => {
|
||||
option.registerOnSelect((value) => this.setValue(value));
|
||||
});
|
||||
|
||||
this._cdr.markForCheck();
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this._onDestroy$.next();
|
||||
this._onDestroy$.complete();
|
||||
@@ -158,6 +146,10 @@ export class SelectComponent<T = any> extends BaseFormControlDirective implement
|
||||
this._open = true;
|
||||
this._forceClose = false;
|
||||
this._cdr.markForCheck();
|
||||
|
||||
this.options.forEach((option) => {
|
||||
option.registerOnSelect((value) => this.setValue(value));
|
||||
});
|
||||
}
|
||||
|
||||
close() {
|
||||
|
||||
Reference in New Issue
Block a user