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="">
|
||||
<label class="form-label">Image {{ $index + 1 }} URL</label>
|
||||
</div>
|
||||
@if (!$first) {
|
||||
@if ($index >= requiredImages) {
|
||||
<button type="button" class="btn btn-outline-danger" (click)="removeImageControl($index)">
|
||||
<i class="bi bi-x-lg"></i>
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -24,8 +24,10 @@ export class CreateEditModalComponent {
|
|||
|
||||
protected editMode: boolean = false
|
||||
protected show?: Show
|
||||
protected requiredImages: number
|
||||
|
||||
constructor() {
|
||||
this.requiredImages = 3
|
||||
this.initForm()
|
||||
}
|
||||
|
||||
|
|
@ -50,7 +52,11 @@ export class CreateEditModalComponent {
|
|||
this.addImageControl(imageUrl)
|
||||
})
|
||||
} 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