-import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core'
+import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, Output, ViewChild } from '@angular/core'
import { Video } from '@app/shared/video/video.model'
import { VideoPlaylistElementUpdate } from '@shared/models'
import { AuthService, ConfirmService, Notifier, ServerService } from '@app/core'
@Component({
selector: 'my-video-playlist-element-miniature',
styleUrls: [ './video-playlist-element-miniature.component.scss' ],
- templateUrl: './video-playlist-element-miniature.component.html'
+ templateUrl: './video-playlist-element-miniature.component.html',
+ changeDetection: ChangeDetectionStrategy.OnPush
})
export class VideoPlaylistElementMiniatureComponent {
@ViewChild('moreDropdown') moreDropdown: NgbDropdown
@Input() playing = false
@Input() rowLink = false
@Input() accountLink = true
+ @Input() position: number
@Output() elementRemoved = new EventEmitter<Video>()
private route: ActivatedRoute,
private i18n: I18n,
private videoService: VideoService,
- private videoPlaylistService: VideoPlaylistService
+ private videoPlaylistService: VideoPlaylistService,
+ private cdr: ChangeDetectorRef
) {}
buildRouterLink () {
video.playlistElement.startTimestamp = body.startTimestamp
video.playlistElement.stopTimestamp = body.stopTimestamp
+
+ this.cdr.detectChanges()
},
err => this.notifier.error(err.message)
this.timestampOptions.stopTimestamp = video.playlistElement.stopTimestamp
}
}
+
+ // FIXME: why do we have to use setTimeout here?
+ setTimeout(() => {
+ this.cdr.detectChanges()
+ })
}
}