5

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?

1
  • It is angulars syntax. Commented Oct 26, 2016 at 6:10

1 Answer 1

7

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.