pagination: ComponentPagination = {
currentPage: 1,
- itemsPerPage: 10,
+ itemsPerPage: 30,
totalItems: null
}
if (previousIndex === newIndex) return
const oldPosition = this.videos[previousIndex].playlistElement.position
- const insertAfter = newIndex === 0 ? 0 : this.videos[newIndex].playlistElement.position
+ let insertAfter = this.videos[newIndex].playlistElement.position
+
+ if (oldPosition > insertAfter) insertAfter--
this.videoPlaylistService.reorderPlaylist(this.playlist.id, oldPosition, insertAfter)
.subscribe(
this.loadElements()
}
+ trackByFn (index: number, elem: Video) {
+ return elem.id
+ }
+
private loadElements () {
this.videoService.getPlaylistVideos(this.videoPlaylistId, this.pagination)
.subscribe(({ totalVideos, videos }) => {