What are the parts of a component?

Angular components and templates · Freshers

Model answer

A component has a class with the data and methods, a template with the HTML the user sees, optional styles scoped to that component, and metadata in the @Component decorator: selector (the tag name), imports (what the template uses), templateUrl or template, and styleUrl or styles.

The class and template are connected: the template can show class data with interpolation and call class methods in response to events.

Learn this topic

Angular Tutorial: Beginner to Advanced .

Sign in to add your own answer.

More questions