diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html index a9b263b..f2223fa 100644 --- a/src/app/home/home.component.html +++ b/src/app/home/home.component.html @@ -1,14 +1,10 @@ Mis viajes - - Logueate para ver tus viajes + + Logueate para ver tus viajes

Viajes disponibles

- + + \ No newline at end of file diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts index 1bbf465..3fc832c 100644 --- a/src/app/home/home.component.ts +++ b/src/app/home/home.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { OAuthService } from 'angular-oauth2-oidc'; -import { ActivatedRoute } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; import { ApiService } from '../services/api.service'; import { Travel } from '../entities/travel'; @@ -26,6 +26,7 @@ export class HomeComponent implements OnInit { constructor( private route: ActivatedRoute, + private router: Router, private oauthService: OAuthService, private apiService: ApiService ) {} @@ -36,6 +37,11 @@ export class HomeComponent implements OnInit { }); } + travelClicked(travel: Travel): void { + console.log(travel); + this.router.navigateByUrl('/travel/' + travel.id); + } + loadUserProfile(): void { this.oauthService.loadUserProfile().then((up) => (this.userProfile = up)); } diff --git a/src/app/list/list.component.html b/src/app/list/list.component.html index 4b5e2e7..939778b 100644 --- a/src/app/list/list.component.html +++ b/src/app/list/list.component.html @@ -50,7 +50,7 @@ - + implements OnInit, AfterViewInit { dataSource: ListDataSource; + @Output() rowClick: EventEmitter = new EventEmitter(); + @Input() displayedColumns: string[]; @Input() url: string; @@ -56,7 +61,11 @@ export class ListComponent implements OnInit, AfterViewInit { .subscribe(); } - load(): void { + rowClicked(row: T): void { + this.rowClick.emit(row); + } + + private load(): void { this.dataSource.load( this.input.nativeElement.value, this.sort.active,