Interacting with the template
As we have learned, creating an Angular component using the Angular CLI involves generating a set of accompanying files. One of these files is the component template containing the HTML content displayed on the page. In this section, we will explore how to display and interact with the template through the following topics:
- Loading the component template
- Displaying data from the component class
- Styling the component
- Getting data from the template
We will start our journey in component template land by exploring how we render the component on the web page.
Loading the component template
We have already learned that Angular uses the selector to load the component in an HTML template. A typical Angular application loads the template of the main component at application startup. The
<app-root> tag we saw in Chapter 1, Building Your First Angular Application, is the selector of the main application component...