
Learning Vue.js 2
By :

Let's imagine the following piece of HTML code:
<div id="hello"></div>
Also, imagine the following JavaScript object:
var data = { msg: 'Hello' };
How can we render the values of data entries on the page? How can we access them so that we can use them inside our HTML? Actually, we have been doing this a lot with Vue.js during the last two chapters. There is no problem in understanding and doing it again and again.
"Repetitio est mater studiorum"
If you are already a professional of data interpolation, just skip this section and proceed to the expressions and filters.
So, what should we do to populate the <div>
with the value of msg
? If we go the old-fashioned jQuery way, we would probably do something like the following:
$("#hello").text(data.msg);
But then, during runtime, if you change the value of msg
and if you want this change to be propagated to the DOM, you must do it manually. By simply changing the data.msg
value,...