Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Commands

ng build --configuration=production

RxJS vs NgRx

Angular Component Files

When you generate a new Angular component using the Angular CLI command ng generate component ComponentName or ng g c ComponentName, the following files are created:

  • component-name.component.ts: This is the main file for the component. It contains the component class and metadata.

  • component-name.component.html: This is the template file for the component. It contains the HTML that Angular will render.

  • component-name.component.css: This is the stylesheet for the component. It contains the CSS that will be applied to the template.

  • component-name.component.spec.ts: This is the testing file for the component. It contains unit tests for the component.

For example, if you generate a component named example, you’ll get these files:

  • example.component.ts
  • example.component.html
  • example.component.css
  • example.component.spec.ts