import {Component, OnInit} from '@angular/core';
import {ProblemService} from '../problem.service';
import {Problem} from '../problem';

@Component({
  selector: 'app-home',
  templateUrl: './home.component.html',
  styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {

  problems: Problem[];

  constructor(private problemService: ProblemService) {
  }

  ngOnInit(): void {
    this.getProblems();
  }

  getProblems(): void {
    this.problemService.getProblems()
      .subscribe(problems => this.problems = problems);
  }

}
