Binding Values to DOM Element Properties in Angular
In Angular, there are two types of binding values to tags: to a tag attribute and to a DOM element property. As a rule, these are the same thing, but sometimes they matter.
Let's look at these two methods with examples. Let's say we have the following class property:
export class AppComponent {
public text: string = 'abcde';
}
Let's output the value of this property to text textarea
<textarea>{{ text }}</textarea>
And now in the attribute placeholder:
<textarea placeholder="{{ text }}"></textarea>
Now let's write the data to the DOM element property. To do this, we'll put the attribute name in square brackets:
<textarea [value]="text"></textarea>
Given an input, write down its property data value.