import { Component, OnInit } from '@angular/core'; import { BackendService, Task } from '../services/backend.service'; @Component({ selector: 'app-task-list', templateUrl: './task-list.component.html', styleUrls: ['./task-list.component.css'] }) export class TaskListComponent implements OnInit { public tasks: Task[] = []; constructor(private backendService: BackendService) { backendService.getTasks().subscribe(t => this.tasks.push(...t)); } ngOnInit(): void { } }