import { Component, OnInit } from '@angular/core'; import { TASKS } from '../tasks.storage'; import { Task } from '../task'; import { Router } from '@angular/router'; @Component({ selector: 'app-tasks', templateUrl: './tasks.component.html', styleUrls: ['./tasks.component.css'] }) export class TasksComponent implements OnInit { tasks!: Task[]; constructor(private router: Router) { } ngOnInit(): void { this.tasks = TASKS; } onClickElement(task: Task): void { this.router.navigate(['task', task.id]) } }