0

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?

Aleksey Solovey
  • 4,153
  • 3
  • 15
  • 34
altgov3en
  • 1,100
  • 2
  • 18
  • 33

2 Answers2

3

"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 ``
Aleksey Solovey
  • 4,153
  • 3
  • 15
  • 34
0

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."

JCDeen
  • 139
  • 10