Generating your first Angular component

For those who haven't had much experience with Angular, a component is basically a Lego brick for the UI. Your web application can be divided into multiple components. Each component has the following files:

  • COMPONENT_NAME.component.ts: The component-logic definition written in TypeScript
  • COMPONENT_NAME.component.html: The HTML code of the component
  • COMPONENT_NAME.component.css: The CSS structure of the component
  • COMPONENT_NAME.component.spec.tsThe unit test of the component class

In our example, we will need at least three components:

  • The Navigation Bar component
  • The List of Movies component
  • The Movie component

Before we create our first component, let's install Bootstrap, which is a frontend ...

Get Hands-On Serverless Applications with Go now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.