In this section, we will learn how to work with DOM elements: accessing them, binding to properties, adding events and handlers, and so on.
Two-way binding
One way to set a property to an element's value is to declare it in the element's attribute, like this:
<input type="text" name="name" value="@Name" />
The named element will receive the value of the Name property, but it will not bind the element to that property. However, the following property will bind:
<input type="text" name="name"
@
bind="Name"
/>
Notice the usage of the @bind keyword. It is used to tie the element to the passed property or field. By default, it hooks to the element's value attribute, because this is the usual one for DOM form elements (input, select...