File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { HomeComponent } from './components/home/home.component';
6
6
import { NewsComponent } from './components/news/news.component' ;
7
7
import { ShowNewsComponent } from './components/news/showNews.component' ;
8
8
import { UserProfile } from './components/user/userProfile.component' ;
9
+ import { EditNewComponent } from './components/Admin/editNew.component' ;
9
10
10
11
//aquí tenemos que completar todo lo que queremos que se vaya cargando en el router-outlet
11
12
//ojo, el template no debe llamar al servicio, hay que hacerlo a través del componente
@@ -17,6 +18,7 @@ const appRoutes = [
17
18
{ path : 'userProfile' , component : UserProfile } ,
18
19
{ path : 'videogamecatalog' , component : VideogameCatalogComponent } ,
19
20
{ path : 'videogame/:id' , component : VideogameDetailComponent } ,
21
+ { path : 'new/edit/:id' , component : EditNewComponent } ,
20
22
{ path : '' , redirectTo : 'home' , pathMatch : 'full' }
21
23
22
24
]
Original file line number Diff line number Diff line change @@ -19,12 +19,12 @@ export class EditNewFormComponent {
19
19
20
20
constructor ( public router : Router , public newsService : NewsService , activatedRoute : ActivatedRoute ) {
21
21
22
- const id = activatedRoute . snapshot . params [ 'id' ] ;
22
+ /* const id = activatedRoute.snapshot.params['id'];
23
23
this.newsService.getNew(id).subscribe(
24
24
(news) => this.news = news as News,
25
25
(error: any) => console.error(error)
26
26
27
- ) ;
27
+ );*/
28
28
29
29
}
30
30
@@ -44,7 +44,7 @@ export class EditNewFormComponent {
44
44
}
45
45
46
46
private afterUploadImage ( news : News ) {
47
- this . router . navigate ( [ '/showNew /' , news . id ] ) ;
47
+ this . router . navigate ( [ '/showNews /' , news . id ] ) ;
48
48
}
49
49
50
50
You can’t perform that action at this time.
0 commit comments