Loading

Basic CLI commands

1. ng new <project-name>: Creates a new Angular project with the specified name.

Example:

ng new my-angular-app

2. ng generate component <component-name>: Generates a new Angular component with the specified name.

Example:

ng generate component header

3. ng generate service <service-name>: Generates a new Angular service with the specified name.

Example:

ng generate service data

4. ng serve: Builds and serves your Angular application locally for development. It watches for changes and automatically refreshes your app in the browser.

5. ng build: Compiles and bundles your Angular application for production. By default, the output goes to the "dist" folder.

Example:

ng build --prod

6. ng test: Run unit tests for your application using a test runner (usually Karma).

Example:

ng test

7. ng e2e: Runs end-to-end tests for your application using a test runner (usually Protractor).

Example:

ng e2e

8. ng lint: Lints your Angular project's code using TSLint (Angular 7 and earlier) or ESLint (Angular 8 and later).

Example:

ng lint

9. ng update: Updates your project's dependencies to the latest versions.

Example:

ng update

10. ng add <package-name>: Adds and configures a package to your Angular project.

Example:

ng add @angular/pwa

11. ng help: Provides a list of Angular CLI commands and options.

Example:

ng help

Above are some of the basic Angular commands used generally in the development of web applications using angular