Angular Project Using Angular CLI is a command line tool which makes it easy for creating and scaffolding an application that works and follows solid practices.
Table of Contents
Installation
1. Node 6.9.0 or higher (node -v)
2. NPM 3 or higher (npm -v)
To Install the Angular CLI
npm install -g angular/cli
That’s it!, Now we can start using Angular CLI
Creating a New Project
ng new [project-name]
This will take a time becaue it will generate a project and also it will install all npm packages
You can also add options:
ng new [project-name] [--option]
Options (ng new)
There are multiple options availbale for ng new command:
routing--routing
It generates routing module which is app.module.ts
ng new jslovely --routing
prefix
–prefix
It will generate component selector with specified prefix name.
Default prefix value is app.
-To change the default prefix value:
ng new jslovely --prefix myapp
Now it will generate all component selector with myapp prefix
style
–style
The style file default extension. Default extension is:css
Possible values are:
- css
- scss
- less
- sass
- styl
ng new jslovely style scss
skip-install
–skip-install
It will skip installing npm packges.
ng new jslovely --skip-install
skip-tests
–skip-tests
It will skip creating .spec files and e2e functionality
ng new jslovely --skip-tests
There are many more options available,I just mentioned some of those which are more often used.
You can find more options here: https://github.com/angular/angular-cli/wiki
Also there is a nice video for Angular CLI by John Papa: https://www.youtube.com/watch?v=h7eVZg3j_Lk
Also Read :
- Angular Material Grid Layout Example
- How to convert string to number in javascript or typescript
- Best websites to learn angular
- Template Reference Variables(#var) in Angular
- How to get names and values of enum in typescript
- Angular Material Date Range Picker
- What’s new in Angular 10
- Top 10 VS Code extensions