Angular now comes with a command line interface (CLI) to make it easier and faster to build Angular applications.

The Angular CLI at the time of writing (09/ 2016) is still in a prototype stage and has a number of issues that still need to be addressed. The biggest is that it doesn’t currently work with the Angular router.

Even without support for the router however the CLI is a useful if not essential tool.


The Angular CLI helps with:

Bootstrapping a project

It creates the initial project structure with a root NgModule and a root component and bootstraps it using the platformBootstrapDynamic method.

The project is also configured to use the webpack loader which handles things like module loading, bundling and minification of dependant code.

Serving and live reloading

The CLI starts a local web-server so we can view our application in the browser via localhost: 4000.

The CLI also watches for any changes to our files and automatically reloads the webpage if there are any.

Code generation

Using the CLI we can create components directives, services, pipes etc… ​ all from the command line with all the necessary files, folders and boilerplate code included.

All the generated code adheres to the official Angular style guide.

In Angular 1 the Angular team never supported an official style guide. This meant that most projects ended up looked pretty different to each other. A developer moving teams would have to figure out from scratch how this team likes to write Angular 1 code.


The generated code also comes with bootstrapped jasmine test spec files, we can use the CLI to compile and run all the tests with a single command.

Whenever the CLI detects changes to any file it re-runs all the tests automatically in the background.

Packaging and releasing

The CLI doesn’t just stop with development, using it we can also package our application ready for release to a server.



Write your comment