Concatenate strings and variable values in angular html template

Just use the simple quotes ' and + sign inside the double quotes of the html attribute value. See the value of the href attribute below:

<div class="float-right mt-1">
  <a
    *ngIf="snippet.public"
    type="button" class="btn btn-light btn-sm float-right"
    href="mailto:?subject=Code snippet: &body=https://www.codever.dev/snippets/"
    title="Share link to snippet via Email">
    <i class="far fa-envelope"></i> Email
  </a>
</div>

Reference - https://github.com/CodeverDotDev/codever


Shared with from Codever. 👉 Use the Copy to mine functionality to copy this snippet to your own personal collection and easy manage your code snippets.

Codever is open source on Github ⭐🙏

Subscribe to our newsletter for more code resources and news

Adrian Matei (aka adixchen)

Adrian Matei (aka adixchen)
Life force expressing itself as a coding capable human being

routerLink with query params in Angular html template

routerLink with query params in Angular html template code snippet Continue reading