title: How to put in angular template to check if a specific array contains an object with property that equals to some value?
body: <p>I have the following in Angular:</p>
  
  <pre><code>&lt;div *ngIf="myarrayContainsEating('Chocolate')"&gt;Chocolate Is Good&lt;/div&gt;
  </code></pre>
  
  <p>In my component, I have:</p>
  
  <pre><code>myarray = [{'name':'Charles', 'age':25, 'eating':'Vanilla'}, {'name':'Joseph', 'age':18, 'eating':'Banana'}]
  
  myArrayContainsEating(food) {
  
    let chocolateExists = false;
    for(var i = 0; myarray.length; i++) {
      if(myarray[i].eating == 'Chocolate') {
         chocolateExists = true;
      }
    }
    return chocolateExists;
  }
  </code></pre>
  
  <p>The problem is, when I have a button where I hit it and make it so that Charles is eating 'Chocolate', it does not show the 'Chocolate Is Good' text I expect. Is there a way to make this work?</p>