diff options
| author | benal01 <bja4245@rit.edu> | 2025-03-26 18:59:55 -0400 | 
|---|---|---|
| committer | benal01 <bja4245@rit.edu> | 2025-03-26 18:59:55 -0400 | 
| commit | 0549991d0b32de4de544d16478ce5b2782c1809d (patch) | |
| tree | 45db75acdd74412d454f2e2a8ee63a371019028f /ufund-ui/src/app/components | |
| parent | 0829feb20e60bc6d323dcc0d9376f4feb45115eb (diff) | |
| download | JellySolutions-0549991d0b32de4de544d16478ce5b2782c1809d.tar.gz JellySolutions-0549991d0b32de4de544d16478ce5b2782c1809d.tar.bz2 JellySolutions-0549991d0b32de4de544d16478ce5b2782c1809d.zip  | |
use (output) for need edit selection
Diffstat (limited to 'ufund-ui/src/app/components')
| -rw-r--r-- | ufund-ui/src/app/components/cupboard/cupboard.component.html | 2 | ||||
| -rw-r--r-- | ufund-ui/src/app/components/need-list/need-list.component.ts | 8 | 
2 files changed, 6 insertions, 4 deletions
diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.html b/ufund-ui/src/app/components/cupboard/cupboard.component.html index c2d146b..4b76f25 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.html +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.html @@ -1,6 +1,6 @@  <div>      <h1> Cupboard </h1> -    <app-need-list [editF]="" #needList></app-need-list> +    <app-need-list (currentNeed) = populateForm($event) #needList></app-need-list>  </div>  <div *ngIf="isManager()" >      <h2 > Admin View </h2> diff --git a/ufund-ui/src/app/components/need-list/need-list.component.ts b/ufund-ui/src/app/components/need-list/need-list.component.ts index bf78d99..2eed87d 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.ts +++ b/ufund-ui/src/app/components/need-list/need-list.component.ts @@ -1,4 +1,4 @@ -import {Component, Input} from '@angular/core'; +import {Component, Output, EventEmitter} from '@angular/core';  import { NgForm } from '@angular/forms';  import {Need} from '../../models/Need';  import {CupboardService} from '../../services/cupboard.service'; @@ -11,11 +11,11 @@ import { userType } from '../../models/User';    styleUrl: './need-list.component.css'  })  export class NeedListComponent { -  selectedNeed: Need | undefined; +  selectedNeed: Need | null = null;    needs: Need[] = [];    searchResults: Need[] = []; -  @Input() editF?: Function +  @Output() currentNeed = new EventEmitter<Need>();    constructor(      private cupboardService: CupboardService, @@ -114,6 +114,8 @@ export class NeedListComponent {    }    select(need : Need) { +    //emit value +    this.currentNeed.emit(need);      if (this.selectedNeed) {        //revert already selected need to previous style        console.log(need.id);  | 
