I am fetching recipes from a database (in an Effect - see code below), where each recipe has ingredients. Here is the corresponding Recipe model code:
export class Recipe {
    id_recipe: number;
    name: string;
    image: string;
    difficulty: number;
    category_id: number;
    country_id: number;
    ingredients: Ingredient[];
}
Here is my angular Code
@Effect()
    fetchRecipes = this.actions$.pipe(
        ofType(RecipesActions.FETCH_RECIPES),
        switchMap(() => {
            return this.http.get<Recipe[]>('http://localhost/recipes/get.php',
            {
                params: new HttpParams().set('q', 'SELECT * FROM recipe')
            })
        }),
        map(recipes => {
            return recipes.map(recipe => {
                return {
                    ...recipe,
                    ingredients: this.http.get<Ingredient[]>('http://localhost/recipes/get.php',
                    {
                        params: new HttpParams().set('q', 'SELECT name, amount, units FROM ingredient INNER JOIN recipe_has_ingredient ON ingredient.id_ingredient = recipe_has_ingredient.id_ingredient WHERE recipe_has_ingredient.id_recipe = ' + recipe.id_recipe)
                    })
                }
            })
        }),
        map(recipes => {
            return new RecipesActions.SetRecipes(recipes);
        })
    );
I want to fetch the ingredients based on the recipe id. Currently I get ingredients as an Observable but I want an array. Could somebody help me out here.
 
    