Angular 2 CLI – Tool

Angular 2 CLI is the tool that allows us to generate our Angular 2 Project with a command line.

angular 2 cli tool
angular 2 cli tool

The idea behind Angular 2 CLI is to make it easy for a program to install a ready to use angular 2 project. Angular 2 CLI downloads all the dependencies and takes care about the versions issues.

1) How to use Angular 2 CLI?

  • Prerequisites : Node 4 or greater
  • Run this command from a terminal (command line / shell)

npm install -g angular-cli

2) How to get help?

ng --help

3) Example:

We want to create an Angular 2 project using the angular 2 CLI tools:


ng new MY_NAME

cd MY_NAME

ng serve

Now navigate to: http://localhost:4200/

Once you change something in your code source the application will reload.

4) what the CLI offers ?

Generating a Project.

Generate : Components, Directives, Pipes, Services, Route.

Builder.

Unit Tests.

End-to-End Tests.

Deploying an App.

Offline applications Support.

Autocompletion features.

CSS Preprocessor integration.

3rd Party Library integration.

5) The project

The Project is on github.