Skip to content

Commit 5b5c5fb

Browse files
committed
videojugos relacionados furula
1 parent ad1b1d5 commit 5b5c5fb

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

frontend/src/app/components/admin/createNewForm.component.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ <h2 style="text-align: center; padding-top: 2%;">Edit New Form</h2>
6868
<div class="col-8">
6969
<p>Related Videogames: </p>
7070
<select name="videogames" multiple style="width: 100%;" ngFor>
71-
<option *ngFor="let vg of videogame">{{ vg.title }}</option>
71+
<option *ngFor="let vg of videogame">
72+
<p>{{ vg.title }}</p>
73+
</option>
7274
</select>
7375
</div>
7476
</div>

frontend/src/app/components/admin/createNewForm.component.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { ActivatedRoute, Router } from "@angular/router";
33
import { News } from "src/app/models/news.model";
44
import { Videogame } from "src/app/models/videogame.model";
55
import { NewsService } from "src/app/services/news.service";
6+
import { VideogameService } from "src/app/services/videogame.service";
67

78
@Component({
89
selector: 'createNewForm',
@@ -23,7 +24,14 @@ export class CreateNewFormComponent {
2324
@ViewChild("file")
2425
file!: any;
2526

26-
constructor(public router: Router, public newsService: NewsService, activatedRoute: ActivatedRoute) { }
27+
constructor(public router: Router, public newsService: NewsService, activatedRoute: ActivatedRoute, private vs: VideogameService) { }
28+
29+
ngOnInit() {
30+
this.vs.getVideogames().subscribe(
31+
videogame => this.videogame = videogame,
32+
error => console.log(error)
33+
);
34+
}
2735

2836
uploadImage(news: News): void {
2937

frontend/src/app/components/admin/createVideogameForm.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Component, Input, ViewChild } from "@angular/core";
22
import { ActivatedRoute, Router } from "@angular/router";
33
import { News } from "src/app/models/news.model";
44
import { Videogame } from "src/app/models/videogame.model";
5+
import { NewsService } from "src/app/services/news.service";
56
import { VideogameService } from "src/app/services/videogame.service";
67

78
@Component({
@@ -58,7 +59,7 @@ export class CreateVideogameForm {
5859
}
5960

6061
save() {
61-
62+
6263
this.videogame = {
6364
title: this.title, price: this.price, company: this.company,
6465
continent: this.continent, genre: this.genre, description: this.description,

0 commit comments

Comments
 (0)