I made a small list of commands which use a lot in Angular CLI and I want to share my list with you.

First of all, we need to install Angular CLI.

npm install -g @angular/cli

This command we need to write in terminal or console.

When cli is installed we need to create our first project:

ng new name-of-project

This command will create an empty project for us. If want to use in our project SCSS files instead of CSS,we must write:

ng new name-of-project --style=scss

After project creation, we need to install all packages which contains in packege.json.

npm intall

Now packages are installed and we can run our project:

ng serve

If we want to run and open our project in browser we should use:

ng serve --open 

By default Angular run project on port:4200, if we want to set another port:

ng serve --port=4222

Also we can use both those option in one command:

ng serve --open --port=4222 

Setting the watch option false will stop automatic rebuilds when you change code:

ng serve --watch=false

When running ng serve, the compiled output is served from memory, not from disk. This means that the application being served is not located on disk in the dist folder.

ng serve --poll 1000

Sometimes could be very useful to build project in production mode:

ng build --prod

Also we could use Ahead of Time Compilation which compiles your app at build time:

ng build --prod --aot

It is time to start developing our project, that means we need to create a new component, class, module, or something else. Angular CLI can help us with that:

ng generate component name-of-component

#angular-cli #angular #cli #front-end-development

Useful command of Angular CLI
2.10 GEEK