I am completely new in Angular 2, and I want to show in my template a string in a variable that should contain inside another variable. I will show you a simplified example of what my problem is and what I want to achieve:
questionnaire.component.ts
name = "Albert"; question.title = "Hello {{name}}, how old are you?";
questionnaire.template.html
<p>{{question.title}}</p>
As a result, I get:
Hello {{name}}, how old are you?
and my desired result:
Hi Albert, how old are you?
I tried to escape from "{{}}" in a string stored in my database, instead of using curly braces I used the ASCII character, placed it inside [innerHTML] ... but the result was always the same.
Do you know how I can solve this?
Many thanks!
javascript html angular typescript binding
Amarquez94
source share