Skip to content

Angular notes

Michael Hulse edited this page Mar 24, 2020 · 7 revisions

Assigning classes

Dissect: https://malcoded.com/posts/angular-ngclass/

Components vs. Directives

When I teach Angular, I keep telling my students that Angular components are custom HTML elements, while Angular directives are custom attributes.

Use components to generate chunks of HTML code, and define them as custom HTML elements. Use directives to modify the behavior or the appearance of an existing HTML element, and use an attribute to activate the directive.

https://www.beyondjava.net/angular-components-non-standard-selectors

Template syntax

  • # = Template reference variable (declares DOM elements as variables: <div #myDiv>blah</div>)
  • () = Event binding
  • [] = Property binding
  • [()] = Two-way property binding
  • {{ }} = Interpolation
  • * = Structural directives
Clone this wiki locally