I've downloaded Angular CLI 6.0.7 for Node and am playing around with it, following tutorials, etc. to learn as much as possible.
One thing I have a question about is data binding. It seems like if I wanted to bind the value of a component member variable, say title
, to an input's value, I have two options: double curly braces or square brackets. These two forms:
<input [value]="title" type="text" />
<input value="{{title}}" type="text" />
Is there any difference between those two approaches, or is it all just stylistic preference? If there's a functional difference, which one is preferred in which situations?
Thanks in advance!
EDIT I understand that curly brackets denote string interpolation, resulting in a string, while square brackets denote property binding, which can use any data type. But what I don't understand is when are those two things functionally different? When would you ever have a DOM element's attribute contain a value that is not equivalent to its stringified version, and how would you even access such an attribute's value properly?