title: How to iterate through object, displaying only results mutual to all of its elements
body: <p>I am making simple app, written on Angular7, that gets input of products (ex. "apple orange strawberry") and displays recipes that have all of the products as an ingredient. Everything needed such as recipes, ingredients and so on is saved in JSON file. It works only when I have one product as an input. The thing is that I want to iterate through all of the ingredients in the input and display the recipes, which ingredients have all of the products. </p>
  
  <p>This is what an object of JSON file looks like:</p>
  
  <pre><code>{
        "id": 1,
        "name": "some name",
        "ingredients": "some ingredients",
        "recipe": "some recipe"
      }
  </code></pre>
  
  <p>This is how I get the input as an object and then split it so I can get each ingredient:</p>
  
  <pre><code> this.pattern = this.searchForm.value;
   this.patternObj = this.pattern.name.split(" ");
  </code></pre>
  
  <p>This is how I filter and collect the elements that have the certain ingredient:</p>
  
  <pre><code>this.result = res.filter(v =&gt; v.ingredients.indexOf(this.patternObj) &gt; -1); 
  </code></pre>
  
  <p>I tried to foreach the patternObj, but in this case it displays only the recipes for the last product of the object.</p>