Skip to content

Commit

Permalink
247 Implementar rutas en la aplicación
Browse files Browse the repository at this point in the history
  • Loading branch information
TheJonaCode committed Oct 19, 2020
1 parent 8d22f2e commit 5721ecf
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
39 changes: 39 additions & 0 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { Router, RouterModule, Routes } from '@angular/router';
import { HomeComponent } from './pages/home/home.component';
import { BuscarComponent } from './pages/buscar/buscar.component';
import { PeliculaComponent } from './pages/pelicula/pelicula.component';

const routes: Routes = [
{
path: 'home',
component: HomeComponent
},
{
path: 'pelicula/:id',
component: PeliculaComponent
},
{
path: 'buscar/:texto',
component: BuscarComponent
},
{
path: '**',
redirectTo: '/hpme'
}

];



@NgModule({
imports: [
CommonModule,
RouterModule.forRoot( routes )
],
exports:[
RouterModule
]
})
export class AppRoutingModule { }
2 changes: 1 addition & 1 deletion src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<h1>Hola Mundo</h1>
<router-outlet></router-outlet>
4 changes: 3 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ import { NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';

import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';

@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
HttpClientModule
HttpClientModule,
AppRoutingModule
],
providers: [],
bootstrap: [AppComponent]
Expand Down

0 comments on commit 5721ecf

Please sign in to comment.