Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

angular

What is the Angular CLI create component?

Nouman Abbasi

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Angular components are the building blocks of the Angular framework.

Generating (or creating) a component in Angular using the CLI is pretty straight-forward.

Usage

To create a component named example, run the following command in the Angular CLI:

ng generate component example

The command performs the following tasks:

  • Creates a directory src/app/example.

  • Inside that directory four files are generated:

    • A CSS file for the component styles
    • An HTML file for the component template
    • A TypeScript file with a component class named ExampleComponent
    • A test file for the ExampleComponent class

The command also adds the ExampleComponent as a declaration in the @NgModule decorator of the src/app/app.module.ts file.

RELATED TAGS

angular

CONTRIBUTOR

Nouman Abbasi
Copyright ©2022 Educative, Inc. All rights reserved

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring