When working with Vue.JS
, I encounter the following situation:
data() {
return {
name: 'John',
sentence: "Hi, my name is {{ name }}",
};
},
In my HTML
file, I have the following line:
<h2>{{ sentence}}</h2>
However, when viewing the output, I see:
Hi, my name is {{name}}
The issue here is that the {{name}}
placeholder is not being replaced. The reason for this approach is to allow dynamic updates from a database where different sentences can be fetched and the name needs to be interchangeable.