|
|
@ -16,6 +16,7 @@ import { MatCardModule } from '@angular/material/card';
|
|
|
|
export class RecipeComponent implements OnInit {
|
|
|
|
export class RecipeComponent implements OnInit {
|
|
|
|
recipe: Recipe | undefined;
|
|
|
|
recipe: Recipe | undefined;
|
|
|
|
ingredientRecipes: IngredientRecipe[] = [];
|
|
|
|
ingredientRecipes: IngredientRecipe[] = [];
|
|
|
|
|
|
|
|
formattedDescription: string = '';
|
|
|
|
|
|
|
|
|
|
|
|
constructor(private route: ActivatedRoute) {}
|
|
|
|
constructor(private route: ActivatedRoute) {}
|
|
|
|
|
|
|
|
|
|
|
@ -28,6 +29,9 @@ export class RecipeComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
|
|
if (this.recipe) {
|
|
|
|
if (this.recipe) {
|
|
|
|
this.ingredientRecipes = this.getIngredientRecipes(this.recipe.id);
|
|
|
|
this.ingredientRecipes = this.getIngredientRecipes(this.recipe.id);
|
|
|
|
|
|
|
|
this.formattedDescription = this.formatDescription(
|
|
|
|
|
|
|
|
this.recipe.description
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -48,4 +52,8 @@ export class RecipeComponent implements OnInit {
|
|
|
|
navBack(): void {
|
|
|
|
navBack(): void {
|
|
|
|
window.history.back();
|
|
|
|
window.history.back();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
formatDescription(description: string): string {
|
|
|
|
|
|
|
|
return description.replace(/(.{50})/g, '$1<br/>');
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|