import { Component, OnInit } from '@angular/core';
import { WriterService } from '../services/writer.service';
import { Writer } from '../models/writer';

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

  constructor(private writerService: WriterService){

  }
  ngOnInit(): void {
    this.allWriters = this.writerService.getAllWriters()
  }
  allWriters: Writer[] = []

  sortByAwards(){
    this.allWriters = this.writerService.sortByAwards()
  }

  sortByBirth(){
    this.allWriters = this.writerService.sortByBirth()
  }
}
