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