What Is Angular CLI?
The Angular CLI (Command Line Interface) is a tool to initialize, develop, scaffold and maintain Angular applications.
OR
The Angular CLI (Command Line Interface) is a set of tools that is used to initialize, develop, generate files, scaffold, and test and maintain Angular application.
The Angular CLI (Command Line Interface) is a tool to initialize, develop, scaffold and maintain Angular applications.
OR
The Angular CLI (Command Line Interface) is a set of tools that is used to initialize, develop, generate files, scaffold, and test and maintain Angular application.
You can use CLI commands to generate an app, the
default AppModule is as follows –
ng new
yourApp
The above CLI command is used to create a new
Angular project and this CLI command automatically creates several folders and files
which are necessary for project development, testing, and configuration and so
on.
To use Angular CLI, we need to install it first and it should be installed
globally in your machine.
npm
install -g
@angular/cli
Example – CREATE your project directory as like below
F:\AngularTestApp\DemoApp>npm install -g @angular/cli
C:\Users\Anil\AppData\Roaming\npm\ng -> C:\Users\Anil\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
C:\Users\Anil\AppData\Roaming\npm
`-- @angular/cli@1.5.0
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\@angular\cli\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
The Angular CLI will add reference to components, directives and pipes automatically in “app.module”.
How To Updating Angular CLI?
If you're using Angular CLI lesser version, uninstall angular-cli package and install new versions.
npm uninstall -g angular-cli
npm uninstall --save-dev angular-cli
Global package -
npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@latest
Local project package -
rm -rf node_modules dist # use rmdir /S/Q node_modules dist in Windows Command Prompt; use rm -r -fo node_modules,dist in Windows PowerShell
npm install --save-dev @angular/cli@latest
npm install
Some Additional Commands -
1. ng new
2. ng serve
3. ng generate
4. ng lint
5. ng test
6. ng e2e
7. ng build
8. ng get
9. ng set
10. ng doc
11. ng eject
12. ng xi18n
13. and so on
I hope you are enjoying with this post! Please share with you friends!! Thank you!!!