Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 input syntax

I've been following the Angular2 tutorial https://angular.io/docs/ts/latest/tutorial/toh-pt6.html and found the following input element syntax (under the "Add a Hero" heading):

<input #heroName />

This is supposedly setting the id attribute of the input element, but I could not find this syntax in the HTML5 specification (https://www.w3.org/TR/html5/syntax.html#attributes-0).

Can anyone explain this syntax?

like image 522
Palo Mraz Avatar asked Oct 26 '16 06:10

Palo Mraz


People also ask

What is the syntax of input tag?

The input tag is used within < form> element to declare input controls that allow users to input data. An input field can be of various types depending upon the attribute type. The Input tag is an empty element which only contains attributes. For defining labels for the input element, < label> can be used.

What is input element in HTML5?

The input element represents a typed data field, usually with a form control to allow the user to edit the data. The type attribute controls the data type (and associated control) of the element. It is an enumerated attribute.


1 Answers

It's not referring to the element id of html5. It's strictly related to angular2 and is a Template reference variable.

So, as said in the official documentation,

The hash (#) prefix to "phone" means that we're defining a phone variable.

In your case is not "phone", but "heroName".

like image 189
GiuServ Avatar answered Sep 29 '22 18:09

GiuServ