import { ServerService } from '@app/core'
import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model'
import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'
+import { VideoConstant } from '../../../../../../shared'
@Component({
selector: 'my-video-caption-add-modal',
@Output() captionAdded = new EventEmitter<VideoCaptionEdit>()
- @ViewChild('modal') modal: ElementRef
+ @ViewChild('modal', { static: true }) modal: ElementRef
- videoCaptionLanguages: any = []
+ videoCaptionLanguages: VideoConstant<string>[] = []
private openedModal: NgbModalRef
private closingModal = false
hide () {
this.closingModal = true
this.openedModal.close()
+ this.form.reset()
}
isReplacingExistingCaption () {
}
async addCaption () {
- this.hide()
-
const languageId = this.form.value[ 'language' ]
- const languageObject = this.videoCaptionLanguages.find((l: any) => l.id === languageId)
+ const languageObject = this.videoCaptionLanguages.find(l => l.id === languageId)
this.captionAdded.emit({
language: languageObject,
captionfile: this.form.value[ 'captionfile' ]
})
- this.form.reset()
+ this.hide()
}
}