title: Escape single quote in Angular UI
body: <p>I am trying to check and therefore not display in the Angular template view if <code>account.DayTimePhone</code> variable has a single quote in it.</p>
  
  <p>This is my code:</p>
  
  <pre><code> &lt;tr ng-if="account.DaytimePhone!=='' &amp;&amp; !(account.DaytimePhone).includes(')"&gt;
    &lt;td class="col-md-6"&gt;Daytime Phone&lt;/td&gt;
   &lt;/tr&gt;
  </code></pre>
  
  <p>I however get an error due to the unescaped single quote character.</p>
  
  <p>I also tried: </p>
  
  <pre><code>!(account.DaytimePhone).includes(\')
  </code></pre>
  
  <p>Would appreciate any ideas on how to check for single quotes appearing in the variable in the view. Thanks in advance.</p>
  
  <p>I know it’s easy to do in back end and have also tried RegEx but same problem in view.</p>
  
  <p>I tried many different ways including single quotes and double and for some reason both these lines get a print out:</p>
  
  <pre><code>&lt;tr ng-if="!account.DaytimePhone.includes('\'')"&gt;
                                  first
  &lt;/tr&gt;
   &lt;tr ng-if="account.DaytimePhone.includes('\'')"&gt;
                                 second
   &lt;/tr&gt;
  </code></pre>
  
  <p>To pinpoint the question: 
  EASIEST WAY TO CHECK FOR SINGLE QUOTES IN ANGULAR VIEW</p>
  
  <p><a href="https://i.stack.imgur.com/JJvrV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JJvrV.png" alt="enter image description here"></a></p>