Fix edit lists behaving wrong

This commit is contained in:
Amelia 2025-05-06 18:52:34 +02:00
parent a9cf6dc286
commit c36123a58f
No known key found for this signature in database
GPG key ID: D6D0ECE365407EAA
2 changed files with 3 additions and 1 deletions

View file

@ -1,6 +1,7 @@
<form [formGroup]="form" *transloco="let t"> <form [formGroup]="form" *transloco="let t">
<div formArrayName="items"> <div formArrayName="items">
@for(item of ItemsArray.controls; let i = $index; track i) { <!-- We are tracking items, as the index will not always point towards the same item. -->
@for(item of ItemsArray.controls; let i = $index; track item) {
<div class="row g-0 mb-3"> <div class="row g-0 mb-3">
<div class="col-lg-10 col-md-12 pe-2"> <div class="col-lg-10 col-md-12 pe-2">
<div class="mb-3"> <div class="mb-3">

View file

@ -69,6 +69,7 @@ export class EditListComponent implements OnInit {
if (this.ItemsArray.length === 1) { if (this.ItemsArray.length === 1) {
this.ItemsArray.at(0).setValue(''); this.ItemsArray.at(0).setValue('');
this.emit(); this.emit();
this.cdRef.markForCheck();
return; return;
} }