|
|
@ -1,8 +1,8 @@
|
|
|
|
import { Component, Input } from '@angular/core';
|
|
|
|
import { Component, Input } from '@angular/core';
|
|
|
|
import { FormBuilder, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
|
|
import { FormBuilder, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
|
|
|
|
|
|
import { Router } from '@angular/router';
|
|
|
|
import { Ingredient, IngredientEntry, Recipe } from '../../cookbook/type';
|
|
|
|
import { Ingredient, IngredientEntry, Recipe } from '../../cookbook/type';
|
|
|
|
import { RecipeService } from '../recipe.service';
|
|
|
|
import { RecipeService } from '../recipe.service';
|
|
|
|
import { Router } from '@angular/router';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
@Component({
|
|
|
|
selector: 'app-recipe-add',
|
|
|
|
selector: 'app-recipe-add',
|
|
|
@ -11,7 +11,6 @@ import { Router } from '@angular/router';
|
|
|
|
templateUrl: './recipe-add.component.html',
|
|
|
|
templateUrl: './recipe-add.component.html',
|
|
|
|
})
|
|
|
|
})
|
|
|
|
export class RecipeAddComponent {
|
|
|
|
export class RecipeAddComponent {
|
|
|
|
|
|
|
|
|
|
|
|
createForm = this.formBuilder.group({
|
|
|
|
createForm = this.formBuilder.group({
|
|
|
|
name: ['', Validators.maxLength(256)],
|
|
|
|
name: ['', Validators.maxLength(256)],
|
|
|
|
description: ['', Validators.maxLength(512)],
|
|
|
|
description: ['', Validators.maxLength(512)],
|
|
|
@ -37,7 +36,7 @@ export class RecipeAddComponent {
|
|
|
|
this.createForm.patchValue({
|
|
|
|
this.createForm.patchValue({
|
|
|
|
name: recipe.name,
|
|
|
|
name: recipe.name,
|
|
|
|
description: recipe.description,
|
|
|
|
description: recipe.description,
|
|
|
|
})
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
constructor(private formBuilder: FormBuilder, private recipes: RecipeService, private router: Router) {}
|
|
|
|
constructor(private formBuilder: FormBuilder, private recipes: RecipeService, private router: Router) {}
|
|
|
@ -73,6 +72,6 @@ export class RecipeAddComponent {
|
|
|
|
idIngredient: id,
|
|
|
|
idIngredient: id,
|
|
|
|
idRecipe: -1,
|
|
|
|
idRecipe: -1,
|
|
|
|
quantity: 1,
|
|
|
|
quantity: 1,
|
|
|
|
})
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|