feat: integrate GenreService into UploadVideoComponent and replace hardcoded genres
This commit is contained in:
parent
87b026ff35
commit
81f449296f
2 changed files with 12 additions and 19 deletions
|
|
@ -46,24 +46,13 @@
|
||||||
[class.error-border]="!genre.valid && genre.touched"
|
[class.error-border]="!genre.valid && genre.touched"
|
||||||
required
|
required
|
||||||
>
|
>
|
||||||
<option value="action">Action</option>
|
<!-- Get genres -->
|
||||||
<option value="adventure">Adventure</option>
|
@if (genres$ | async; as genres) {
|
||||||
<option value="animation">Animation</option>
|
|
||||||
<option value="anime">Anime</option>
|
<!-- Loop through genres -->
|
||||||
<option value="comedy">Comedy</option>
|
@for (genre of genres; track genre) {
|
||||||
<option value="crime">Crime</option>
|
<option [value]="genre.name">{{ genre.name }}</option>
|
||||||
<option value="documentary">Documentary</option>
|
} }
|
||||||
<option value="drama">Drama</option>
|
|
||||||
<option value="fantasy">Fantasy</option>
|
|
||||||
<option value="horror">Horror</option>
|
|
||||||
<option value="musical">Musical</option>
|
|
||||||
<option value="mystery">Mystery</option>
|
|
||||||
<option value="other">Miscellaneous</option>
|
|
||||||
<option value="romance">Romance</option>
|
|
||||||
<option value="science_fiction">Science Fiction</option>
|
|
||||||
<option value="thriller">Thriller</option>
|
|
||||||
<option value="war">War</option>
|
|
||||||
<option value="western">Western</option>
|
|
||||||
</select>
|
</select>
|
||||||
<div class="error-msg">
|
<div class="error-msg">
|
||||||
@if (!genre.valid && genre.touched) {
|
@if (!genre.valid && genre.touched) {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import { BtnLargeComponent } from '../../../shared/components/buttons/btn-large/
|
||||||
import { VideoService } from '../../../services/video.service';
|
import { VideoService } from '../../../services/video.service';
|
||||||
import { LoadingDialogComponent } from '../../../shared/components/loading-dialog/loading-dialog.component';
|
import { LoadingDialogComponent } from '../../../shared/components/loading-dialog/loading-dialog.component';
|
||||||
import { Video } from '../../../interfaces/video.interface';
|
import { Video } from '../../../interfaces/video.interface';
|
||||||
|
import { GenreService } from '../../../services/genre.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-upload-video',
|
selector: 'app-upload-video',
|
||||||
|
|
@ -33,9 +34,12 @@ export class UploadVideoComponent {
|
||||||
send: false,
|
send: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
genres$ = this.genreService.getGenres();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public errorService: ErrorService,
|
public errorService: ErrorService,
|
||||||
private videoService: VideoService
|
private videoService: VideoService,
|
||||||
|
private genreService: GenreService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
stopPropagation(event: MouseEvent) {
|
stopPropagation(event: MouseEvent) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue