title: Angular: How to conditionaly add an attribute in the template after checking if a variable is defined?
body: <p>How to conditionaly add an attribute in the template after checking if a variable is defined?
  I want to add an attribute with the variable value to an HTML tag, but this variable might not exist. How can I check that?</p>
  <p>In the following example, myVariable might not be defined in the component and it will throw an error:</p>
  <pre><code>&lt;i class=&quot;fa fa-file-excel-o&quot; title=&quot;myVariable ? myVariable : null&quot;&gt;&lt;/i&gt;
  </code></pre>