Use either:
<a href="https://www.domainname.com/?q={{text.id}}">URL</a>
or (from the official docs):
<a [href]="'https://www.domainname.com/?q=' + text.id">URL</a>
Regarding the question, it’s important to notice:
The error message is misleading.
When you use {{ expression }}
, angular will evaluate the expression
and place its value right where the {{}}
is. So you don’t need to +
the result of {{}}
to the string as you do. In other words:
<a href="https://stackoverflow.com/questions/40336155/something="+{{ expression }}> WRONG </a>
<a href="something={{ expression }}"> RIGHT </a>
<a [href]=""https://stackoverflow.com/questions/40336155/something=" + expression"> RIGHT </a>