A component is a logical grouping of functionalities, views, and styles applicable to the view and a class associated to the component that deals with these artifacts. Components take responsibility for rendering the view as per the business logical requirements.
We can generate code for components using Angular CLI. This tool is very handy in scaffolding the components. Let's generate a component named booklist for our application by executing the following statement. Navigate to the Angular project folder by executing the command here:
cd BookList
Then, execute the following Angular CLI command to generate the component Booklist:
ng generate component booklist
Executing the preceding statement creates the booklist.component.css, booklist.component.html, booklist.component.spec.ts and the booklist.component.ts, as shown in the following...