Palo Mraz
Palo Mraz

Reputation: 909

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?

Upvotes: 5

Views: 689

Answers (1)

GiuServ
GiuServ

Reputation: 1235

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

Upvotes: 7

Related Questions