Skip to content

Angular CLI In Depth

The Angular CLI is a powerful tool to initialize, develop, scaffold, and maintain Angular applications. Common commands:

  • Generate a new component

    Terminal window
    ng generate component user-profile
    # or shorthand: ng g c user-profile

    This creates the component files and (if using modules) updates the module.

  • Generate a service

    Terminal window
    ng generate service data
  • Build the project

    Terminal window
    ng build

    Outputs the compiled files to the dist/ folder.

  • Serve with development server

    Terminal window
    ng serve --open

    Opens the app automatically.

  • Run unit tests

    Terminal window
    ng test
  • Run end‑to‑end tests

    Terminal window
    ng e2e
  • Update Angular and dependencies

    Terminal window
    ng update

For a full list, run ng help.