Welcome to the free & complete Angular Tutorial.
This lesson is all about Introduction to Angular command line interface (cli) commands.
If you are yet to install Angular CLI in your machine, please install it from their website.
As you may already know, Angular CLI (ng) is used to create new projects, build / package application, in this post we will see what are the frequently used commands in Angular app development.
Full list of Angular CLI commands is here.
Let’s begin !
Creates a new workspace and an initial Angular app.
ng new <project name>
ng n <project name>
Generates and/or modifies files based on a schematic.
ng generate [options]
ng g [options]
ng generate class <class name>
ng generate module <module name>
ng generate component <component name>
ng generate pipe <pipe name>
ng generate service <service name>
ng generate directive <directive name>
Compiles an Angular app into an output directory named dist/ at the given output path. Must be executed from within a workspace directory.
ng build <project> [options]
ng b <project> [options]
To build the application with production target configuration, add option –prod=true as given below:
ng build –prod=true
ng build –prod
Builds and serves your app, rebuilding on file changes.
If you want the URL to be opened in default browser:
ng serve –open
ng serve -o
ng s –open
ng s -o
Opens the official Angular documentation (angular.io) in a browser, and searches for a given keyword.
ng doc [options]
ng d [options]
ng d module
ng d pipe
Lists available commands and their short descriptions.
ng help [options]
ng help generate
ng help serve
For detailed list of all commands, please take a look at official Angular documentation.