Component anatomy
Learn Component anatomy (Module 4 · Components, Angular) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
What is a component? • A component is a LEGO brick of your UI: a TypeScript class (data and behaviour), an HTML template (what is shown) and optional CSS (how it looks). A page is a tree of components : an app shell contains a header, a course list, and each course card is a component too. This is the component architecture of Angular. • The @Component decorator marks a class as a component and carries its metadata . The selector is the custom HTML tag you write to place it.