Guest User

Untitled

a guest
Jul 19th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. import { Component, OnInit, ViewChild, ElementRef, EventEmitter, Output } from '@angular/core';
  2. import { Ingredient } from '../../shared/Ingredient.model';
  3. @Component({
  4. selector: 'app-shopping-list-edit',
  5. templateUrl: './shopping-list-edit.component.html',
  6. styleUrls: ['./shopping-list-edit.component.css']
  7. })
  8. export class ShoppingListEditComponent implements OnInit {
  9. @ViewChild('name') ingredientName:ElementRef;
  10. @ViewChild('amount') ingredientAmount:ElementRef;
  11. @Output() inputValue = new EventEmitter<Ingredient>();
  12.  
  13.  
  14. constructor() { }
  15.  
  16. ngOnInit() {
  17. }
  18. onSubmit(){
  19. const iname = this.ingredientName.nativeElement.value;
  20. const iamount = this.ingredientAmount.nativeElement.value;
  21. loadedIngredient:Ingredient = new Ingredient(iname,iamount);
  22. this.inputValue.emit(loadedIngredient);
  23. }
  24.  
  25. }
  26.  
  27. ERROR in src/app/shopping-list/shopping-list-edit/shopping-list-edit.component.t s(21,4): error TS7028: Unused label. src/app/shopping-list/shopping-list-edit/shopping-list-edit.component.ts(21,21): error TS2539: Cannot assign to 'Ingredient' because it is not a variable. src/app/shopping-list/shopping-list-edit/shopping-list-edit.component.ts(22,25): error TS2304: Cannot find name 'loadedIngredient'.
Add Comment
Please, Sign In to add comment