Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Component, OnInit, ViewChild, ElementRef, EventEmitter, Output } from '@angular/core';
- import { Ingredient } from '../../shared/Ingredient.model';
- @Component({
- selector: 'app-shopping-list-edit',
- templateUrl: './shopping-list-edit.component.html',
- styleUrls: ['./shopping-list-edit.component.css']
- })
- export class ShoppingListEditComponent implements OnInit {
- @ViewChild('name') ingredientName:ElementRef;
- @ViewChild('amount') ingredientAmount:ElementRef;
- @Output() inputValue = new EventEmitter<Ingredient>();
- constructor() { }
- ngOnInit() {
- }
- onSubmit(){
- const iname = this.ingredientName.nativeElement.value;
- const iamount = this.ingredientAmount.nativeElement.value;
- loadedIngredient:Ingredient = new Ingredient(iname,iamount);
- this.inputValue.emit(loadedIngredient);
- }
- }
- 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