diff --git a/src/app/event-list/event-list.component.html b/src/app/event-list/event-list.component.html index e04ecd57..77156100 100644 --- a/src/app/event-list/event-list.component.html +++ b/src/app/event-list/event-list.component.html @@ -8,8 +8,8 @@

Events are:

-
  • - go to event +
  • + go to event

    {{event | json}}

  • diff --git a/src/app/event-list/event-list.component.ts b/src/app/event-list/event-list.component.ts index 8d472ffc..dcdce9bd 100644 --- a/src/app/event-list/event-list.component.ts +++ b/src/app/event-list/event-list.component.ts @@ -1,5 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { EventService } from '../shared/event.service'; +import { Router } from '@angular/router'; @Component({ selector: 'app-event-list', @@ -10,10 +11,16 @@ export class EventListComponent implements OnInit { events: any; - constructor(private eventService: EventService) { } + constructor(private eventService: EventService, private router: Router) { } ngOnInit() { - this.events = this.eventService.getEvents(); + this.eventService.getEvents().subscribe(res => { + if(res.singleEvent) { + this.router.navigate(['/event', res.eventShortName]); + } else { + this.events = res.events; + } + }) } }