Year End Sale: Get Upto 40% OFF on Live Training! Offer Ending in
D
H
M
S
Get Now

Angular CLI

Level : Beginner
Mentor: Shailendra Chauhan
Duration : 00:03:00

npm install -g @angular/cli

Installs the Angular CLI globally on your system, allowing you to create and manage Angular projects using the command line.

ng version

Displays the version of the installed Angular CLI and other relevant Angular packages.

ng new <application name>

Creates a new Angular application with the specified name, generating the basic project structure.

ng new <application name> --prefix best

Creates a new Angular application with a custom prefix for the generated components, helping avoid naming conflicts.

ng new --help

Provides information on the options and flags available when creating a new Angular application using the CLI.

ng lint my-app

Analyzes the TypeScript code in the specified application for linting issues, highlighting code quality and style problems.

ng lint my-app --fix

Automatically fixes certain linting issues in the specified application's TypeScript code.

ng lint my-app --format stylish

Specifies a specific output format (stylish) for the linting results.

ng lint my-app --help

Displays the available options and flags when using the ng lint command.

ng add <package name>

Adds a package to an existing Angular project, automating necessary configurations and installations.

ng generate component <name>

Generates a new Angular component with the specified name, including the necessary files and code structure.

ng g s <service name>

Creates a new Angular service with the specified name, providing a template for implementing business logic and data manipulation.

ng g cl <destination>

Generates a new Angular class in the specified destination folder, aiding in creating reusable code.

ng build

Compiles and builds the Angular application, creating output files that can be deployed to a web server.

ng serve

Starts a local development server and serves the Angular application, allowing you to view and interact with it during development.

ng serve -o

Opens the application in a default web browser after starting the development server.

ng serve --ssl

Enables SSL support for the local development server, providing a secure connection.

ng generate

The base command for generating various Angular artifacts like components, services, modules, etc.

ng g c MyComponent -d

Generates a new Angular component named MyComponent and adds it to the default app module.

ng g c MyComponent --export

Generates a new Angular component and adds it to the default app module while marking it for export.

ng g c MyComponent -f

Forces the generation of a new Angular component even if the default app module has not been set.

ng g c --help

Displays the available options and flags when using the ng generate component command.
Self-paced Membership
  • 24+ Video Courses
  • 825+ Hands-On Labs
  • 400+ Quick Notes
  • 125+ Skill Tests
  • 10+ Interview Q&A Courses
  • 10+ Real-world Projects
  • Career Coaching Sessions
  • Email Support
Upto 60% OFF
Know More
Still have some questions? Let's discuss.
CONTACT US
Accept cookies & close this