aboutsummaryrefslogtreecommitdiff
path: root/ufund-ui/src/app/components/need-page/need-page.component.ts
blob: 15c1e87c371edef6753d2a17d2d06464c6704389 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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);
  }
}