Pages/shows: add functionality to edit button
This commit is contained in:
parent
e35564735f
commit
312fedec7b
2 changed files with 12 additions and 1 deletions
|
|
@ -9,7 +9,7 @@
|
|||
<button type="button" class="btn btn-outline-danger" (click)="deleteShow(show)">
|
||||
<i class="bi bi-trash"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline-warning">
|
||||
<button type="button" class="btn btn-outline-warning" (click)="editShow(show, $index)">
|
||||
<i class="bi bi-pencil"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -82,4 +82,15 @@ export class ShowsComponent {
|
|||
}
|
||||
)
|
||||
}
|
||||
|
||||
editShow(show: Show, index: number) {
|
||||
const modal: NgbModalRef = this.modalService.open(CreateEditModalComponent)
|
||||
modal.componentInstance.editMode = true
|
||||
modal.componentInstance.show = show
|
||||
modal.componentInstance.initForm()
|
||||
modal.result.then(
|
||||
(closeResult: Show) => {this.shows[index] = closeResult},
|
||||
(dissmissResult) => {}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue