import { Injectable } from '@angular/core'; import { Router } from '@angular/router'; import { Eventoi } from '../interfaces/eventoi'; import { ApiService } from './api.service'; @Injectable({ providedIn: 'root' }) export class FeedService { eventos: Eventoi[]; constructor(private apiService: ApiService, private router: Router) { } initFeed(): void{ this.apiService.getEventos() .subscribe(eventos => { this.eventos = eventos; this.router.navigate(['/tabsUser']) }) } }