|
@@ -1,5 +1,6 @@
|
|
|
import { Component, Input, Output } from '@angular/core';
|
|
import { Component, Input, Output } from '@angular/core';
|
|
|
import { MatDialog } from '@angular/material/dialog';
|
|
import { MatDialog } from '@angular/material/dialog';
|
|
|
|
|
+import { DialogService } from 'primeng/dynamicdialog';
|
|
|
import { Observable, Subject } from 'rxjs';
|
|
import { Observable, Subject } from 'rxjs';
|
|
|
import { Track } from '../track';
|
|
import { Track } from '../track';
|
|
|
import { TrackPickerDialogComponent } from '../track-picker-dialog/track-picker-dialog.component';
|
|
import { TrackPickerDialogComponent } from '../track-picker-dialog/track-picker-dialog.component';
|
|
@@ -7,7 +8,10 @@ import { TrackPickerDialogComponent } from '../track-picker-dialog/track-picker-
|
|
|
@Component({
|
|
@Component({
|
|
|
selector: 'app-track-picker',
|
|
selector: 'app-track-picker',
|
|
|
templateUrl: './track-picker.component.html',
|
|
templateUrl: './track-picker.component.html',
|
|
|
- styleUrls: ['./track-picker.component.scss']
|
|
|
|
|
|
|
+ styleUrls: ['./track-picker.component.scss'],
|
|
|
|
|
+ providers: [
|
|
|
|
|
+ DialogService
|
|
|
|
|
+ ]
|
|
|
})
|
|
})
|
|
|
export class TrackPickerComponent {
|
|
export class TrackPickerComponent {
|
|
|
private readonly trackChangeSubject: Subject<Track | undefined> = new Subject<Track | undefined>();
|
|
private readonly trackChangeSubject: Subject<Track | undefined> = new Subject<Track | undefined>();
|
|
@@ -18,16 +22,17 @@ export class TrackPickerComponent {
|
|
|
@Output()
|
|
@Output()
|
|
|
public trackChange: Observable<Track | undefined> = this.trackChangeSubject.asObservable();
|
|
public trackChange: Observable<Track | undefined> = this.trackChangeSubject.asObservable();
|
|
|
|
|
|
|
|
- public constructor(private readonly dialog: MatDialog) {
|
|
|
|
|
|
|
+ public constructor(public dialogService: DialogService) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public pick(): void {
|
|
public pick(): void {
|
|
|
- const dialogRef = this.dialog.open(TrackPickerDialogComponent, {
|
|
|
|
|
|
|
+ const dialogRef = this.dialogService.open(TrackPickerDialogComponent, {
|
|
|
|
|
+ header: 'Choose a Track',
|
|
|
width: '60%',
|
|
width: '60%',
|
|
|
height: '80%',
|
|
height: '80%',
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- dialogRef.afterClosed().subscribe(result => {
|
|
|
|
|
|
|
+ dialogRef.onClose.subscribe(result => {
|
|
|
console.log('The dialog was closed', result);
|
|
console.log('The dialog was closed', result);
|
|
|
if (result === null || result) {
|
|
if (result === null || result) {
|
|
|
this.track = result;
|
|
this.track = result;
|