import {Component, Input} from '@angular/core';
import {Need} from '../../models/Need';
import {ActivatedRoute} from "@angular/router";
import {CupboardService} from "../../services/cupboard.service";
@Component({
selector: 'app-need-page',
standalone: false,
templateUrl: './need-page.component.html',
styleUrl: './need-page.component.css'
})
export class NeedPageComponent {
constructor(
private route: ActivatedRoute,
private cupboardService: CupboardService,
) {}
@Input() need?: Need;
ngOnInit(): void {
const id = Number(this.route.snapshot.paramMap.get('id'));
this.cupboardService.getNeed(id).subscribe(n => this.need = n);
}
}