Skip to main content

Component Creation and Template Binding

Learn Component Creation and Template Binding (Phase 3 · Components and Templates (Core), Angular) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Interpolation and property binding • Interpolation {{ expression }} renders a value as text (escaped, so safe from XSS). Property binding [prop]="expr" sets a DOM property ( [src] , [disabled] , [value] , [hidden] ) from an expression. • Attribute, class and style bindings: [attr.aria-label]="label" , [class.active]="isActive" , [style.width.px]="width" . • Use property binding, never interpolation, for non-string values such as booleans.

More lessons in Phase 3 · Components and Templates (Core)