liveBook · Manning

Attribute

As explained in Pro Angular 16

An object property is a named value or function associated with a JavaScript object.

An HTML attribute adds information or behavior to an element. It appears in the start tag and usually has a name and value, such as charset="utf-8"; some attributes, such as required, need no value. section 3.2.2 section 3.2.3

Angular also applies features through HTML attributes. Attribute values may be evaluated as JavaScript expressions; quote a string inside the attribute value when you want Angular to treat it as a literal. section 3.2.4 section 9.4.4

Expression versus literal

In [ngSwitch]="item.complete", Angular reads the complete property from item. In [ngSwitch]="'Apples'", the inner quotes make Apples a literal string. section 3.2.4

...
<meta charset="utf-8" />
...

A meta element shows a name-value attribute in its start tag. section 3.2.2

An object property is related terminology, but not the same thing as an HTML attribute: JavaScript objects have named properties whose values can be data or functions. section 4.4 section 4.6

How Pro Angular 16 covers it

How deep it goes
Defines valued and valueless forms and demonstrates Angular expressions and literal quoting without detailing parsing internals.
Examples
Shows charset="utf-8", a required input, quoted Apples, and Angular Material button attributes.
What you can do after
Understand how HTML attributes configure elements and carry Angular expressions or literal values.
How it connects
Connects HTML attributes with elements, Angular templates, JavaScript expressions, and CSS selectors.

Also explained in

Compare how 26 books explain attribute →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Pro Angular 16. The section links point to the parts of the book it draws on.