title: Conditionally change color of angularjs element?
body: <p>Im still pretty new to AngularJS. Im trying to change the color of the table element so that its yellow if the user voted on this choice.</p>
  
  <pre><code>&lt;div ng-show="poll.userVoted"&gt;
      &lt;table class="result-table"&gt;
          &lt;tr ng-repeat="choice in poll.choices"&gt;
              &lt;td&gt;{{choice.text}}&lt;/td&gt;
              &lt;td&gt;
              &lt;table ng-if="choice.text == poll.userChoice.text" style="background-color: yellow; width: {{choice.votes.length/poll.totalVotes*100}}%; text-align: right"&gt;
                  &lt;tr&gt;
  
                          &lt;td&gt;{{choice.votes.length}}&lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/table&gt;
              &lt;table ng-if="choice.text != poll.userChoice.text" style="background-color: lightblue; width: {{choice.votes.length/poll.totalVotes*100}}%; text-align: right"&gt;
                  &lt;tr&gt;
  
                      &lt;td&gt;{{choice.votes.length}}&lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/table&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/QIT9K.png" alt="enter image description here"></p>