Components/create-edit-modal: change number of required images
This commit is contained in:
parent
d7c9e892d4
commit
c2c008c952
2 changed files with 8 additions and 2 deletions
|
|
@ -40,7 +40,7 @@
|
||||||
<input formControlName="{{$index}}" type="text" class="form-control" placeholder="">
|
<input formControlName="{{$index}}" type="text" class="form-control" placeholder="">
|
||||||
<label class="form-label">Image {{ $index + 1 }} URL</label>
|
<label class="form-label">Image {{ $index + 1 }} URL</label>
|
||||||
</div>
|
</div>
|
||||||
@if (!$first) {
|
@if ($index >= requiredImages) {
|
||||||
<button type="button" class="btn btn-outline-danger" (click)="removeImageControl($index)">
|
<button type="button" class="btn btn-outline-danger" (click)="removeImageControl($index)">
|
||||||
<i class="bi bi-x-lg"></i>
|
<i class="bi bi-x-lg"></i>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,10 @@ export class CreateEditModalComponent {
|
||||||
|
|
||||||
protected editMode: boolean = false
|
protected editMode: boolean = false
|
||||||
protected show?: Show
|
protected show?: Show
|
||||||
|
protected requiredImages: number
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
this.requiredImages = 3
|
||||||
this.initForm()
|
this.initForm()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -50,7 +52,11 @@ export class CreateEditModalComponent {
|
||||||
this.addImageControl(imageUrl)
|
this.addImageControl(imageUrl)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.addImageControl()
|
let i: number = this.requiredImages
|
||||||
|
do {
|
||||||
|
this.addImageControl()
|
||||||
|
i--
|
||||||
|
} while (i != 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue