Angular CLI Commands - Cheat Sheet

Angular CLI (Command Line Interface) is one of the powerful tool that allows you to perform a lot of actions in an Angular project by using simple commands.

We can use the CLI tool directly in a command shell, or indirectly through an interactive UI such as Angular Console. 

The Best Advantage is that, can avoid manual process to create lot of stuff like create components, directives, feature modules, services... etc. 

It automatically recompiles the source code files and refreshes the app in the browser. 

Let's see, how to install CLI tool and what are those CLI commands.

Installing the CLI is very quite easy. All we need to do, is to run the below command in Terminal or Console. It will install the CLI tool globally with respective version.

Here we need to know two things before installing the CLI tool. We can install latest version or any version released by angular team based on your project need. Check the Versions list.✋

Angular CLI Setup 

1. Globally - To install CLI tool globally, we include the 'g'.

2. Locally - To install CLI tool locally at application level, we do not include the 'g'.


We are done installing the Angular CLI tool, now we have to know which version was installed.
For that which command we need to use ?

Checking Angular Version 



Now we are done installation and checking the CLI tool. We will look into the CLI commands list.

List of  CLI Commands 

ng generate :
Generates new angular code components.


syntax : ng generate application [application name] [options].

example : ng g application application-name -dryRun


ng new : Generates new angular project.






syntax : ng new projectname [optionswithflag].

example : ng new testproject -dryRun=true

Comments

Popular posts from this blog

Create Custom Form Control for ng-select in Angular

Send API POST Request in MS SQL Server

Restrict Special Characters Using JavaScript By Copy,Paste

Create Extension Method in typescript - String.IsNullOrEmpty()

Export to Excel in Angular 6 | 7 | 8 | 9 | 10

Domain Driven Design (DDD) in .NET Core