Reputation: 1206
After more than a year of working with Angular/JS, I still don't have an intuitive understanding of what is interpolation (e.g. {{1+4}}
). What is the origin of the of the term (in Angular/JS context) and does it have anything in common with the mathematical term?
Upvotes: 0
Views: 1224
Reputation: 139
I was puzzled by the same thing, having only recently begun learning Angular. In my training from college, "interpolation" was a strictly mathematical term. This definition makes slightly more sense for me: "Another way of describing it is the act of inserting or interjecting an intermediate value between two other values."
Upvotes: 0
Reputation: 4191
"Interpolation - the insertion of something of a different nature into something else".
It's a term used for embedding expressions into template literal, which work as placeholders.
In JavaScript you can have the same concept with string interpolation:
var a = 1;
var b = 4;
console.log(`Interpolated result is: ${a+b}`); // note: the quotes ``
Upvotes: 3