diff options
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);  | 
