From 21c400ff81ee7b0f3f43812acce7bd88fa5ad0de Mon Sep 17 00:00:00 2001 From: mpuebla Date: Tue, 6 Aug 2019 15:21:22 -0300 Subject: [PATCH] Cambio en componente home, agregadas rutas. --- src/app/app-routing.module.ts | 8 +++- src/app/app.component.html | 7 ---- src/app/app.module.ts | 4 +- src/app/home/home.component.html | 71 +++++++++++++++++++--------------- src/app/home/home.component.ts | 10 ++++- src/app/sidebar/sidebar.component.html | 4 +- 6 files changed, 60 insertions(+), 44 deletions(-) diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index d425c6f..ee42ad5 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,7 +1,13 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; +import { HomeComponent } from './home/home.component'; +import { CargarProductosComponent } from './cargar-productos/cargar-productos.component'; -const routes: Routes = []; +const routes: Routes = [ + { path: 'home', component: HomeComponent }, + { path: 'cargar-productos', component: CargarProductosComponent }, + { path: '**', redirectTo: '/home', pathMatch: 'full' }, +]; @NgModule({ imports: [RouterModule.forRoot(routes)], diff --git a/src/app/app.component.html b/src/app/app.component.html index 20ca503..90c6b64 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,8 +1 @@ -
-
-
- -
-
-
\ No newline at end of file diff --git a/src/app/app.module.ts b/src/app/app.module.ts index afd5fce..7d59170 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -7,6 +7,7 @@ import { HeaderComponent } from './header/header.component'; import { SidebarComponent } from './sidebar/sidebar.component'; import { CarouselComponent } from './carousel/carousel.component'; import { HomeComponent } from './home/home.component'; +import { CargarProductosComponent } from './cargar-productos/cargar-productos.component'; @NgModule({ declarations: [ @@ -14,7 +15,8 @@ import { HomeComponent } from './home/home.component'; HeaderComponent, SidebarComponent, CarouselComponent, - HomeComponent + HomeComponent, + CargarProductosComponent ], imports: [ BrowserModule, diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html index 2e92326..192f3ed 100644 --- a/src/app/home/home.component.html +++ b/src/app/home/home.component.html @@ -1,38 +1,47 @@ - -
-

HEADER

-
+
+
+
+
+ + +
+

HEADER

+
-
-
-
-
- - -
- - -
-

FOOTER

\ No newline at end of file diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts index f56c8c1..987b90f 100644 --- a/src/app/home/home.component.ts +++ b/src/app/home/home.component.ts @@ -1,4 +1,5 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, HostListener } from '@angular/core'; +import { Router } from '@angular/router'; @Component({ selector: 'app-home', @@ -7,9 +8,14 @@ import { Component, OnInit } from '@angular/core'; }) export class HomeComponent implements OnInit { - constructor() { } + constructor(private router: Router) { } ngOnInit() { } + @HostListener('document:click', ['$event']) + documentClick(event: MouseEvent) { + this.router.navigate(['/cargar-productos']); + } + } diff --git a/src/app/sidebar/sidebar.component.html b/src/app/sidebar/sidebar.component.html index 2ecb1fb..0a946bc 100644 --- a/src/app/sidebar/sidebar.component.html +++ b/src/app/sidebar/sidebar.component.html @@ -1,4 +1,4 @@ -<
+

Mi compra

@@ -39,4 +39,4 @@
-
\ No newline at end of file +
\ No newline at end of file -- 1.9.1