A component template is declarative markup that defines a component’s view and data bindings. It is a central part of the component, not merely an optional rendering detail. section 8.3.3
Component templates support several practical responsibilities:
- Compose larger interfaces by invoking other components and directives. section 4.2
- Render child components, routed content, and other declared template elements. section 8.3.3
- Provide behavior that should be verified separately from the component class. section 8.3.3
Testing a rendered template
Create the component with Angular’s testing tools, trigger change detection, query rendered elements such as app-header, app-footer, and router-outlet, and assert that they exist. For reusable components, Angular Testing Library can render the component with imports, mocked providers, and inputs, then verify visible text such as a project name. Changing an input and detecting changes verifies the updated template output. section 8.3.3


