import { Component, Input, ViewChild } from '@angular/core'
-import { MarkdownService } from '@app/videos/shared'
-
-import { ModalDirective } from 'ngx-bootstrap/modal'
import { VideoDetails } from '../../../shared/video/video-details.model'
+import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
+import { MarkdownService } from '@app/shared/renderer'
@Component({
selector: 'my-video-support',
export class VideoSupportComponent {
@Input() video: VideoDetails = null
- @ViewChild('modal') modal: ModalDirective
+ @ViewChild('modal') modal: NgbModal
videoHTMLSupport = ''
- constructor (private markdownService: MarkdownService) {
- // empty
- }
+ constructor (
+ private markdownService: MarkdownService,
+ private modalService: NgbModal
+ ) { }
show () {
- this.modal.show()
-
- if (this.video.support) {
- this.videoHTMLSupport = this.markdownService.enhancedMarkdownToHTML(this.video.support)
- } else {
- this.videoHTMLSupport = ''
- }
- }
+ this.modalService.open(this.modal)
- hide () {
- this.modal.hide()
+ this.markdownService.enhancedMarkdownToHTML(this.video.support)
+ .then(r => this.videoHTMLSupport = r)
}
}