Skip to content
Scott edited this page Jul 14, 2017 · 7 revisions

Angular CLI

angular-cli is a wonderful CLI tool to generate Angular2 projects, components, and services, as well as administrative functions like starting a local server. The use of this project requires:

  • installation of node.js.
  • installation of angular-cli with:

npm install -g @angular/cli.

ng commands

After that you can begin exploring with the ng command (ex: ng new myproject to generate an Angular2 project).

It is recommended to use angular-cli when you wish to generate an Angular2 project, components, services, etc because it follows the Angular2 recommendations and provides commands like ng serve which starts your application with a server which supports Live Reloading (if you change your CSS or ts files in your Eclipse workspace, the browser is refreshed with your changes).

Angular2 IDE provides 3 means to consume angular-cli:

Editors

Angular CLI configuration is done with:

  • angular-cli.json to customize Angular CLI.
  • .ember-cli to customize server (port of the server, live reloading port, etc).

Angular2 Eclipse provides an editor for those configuration files.

angular-cli.json

Angular2 Eclipse provides an angular-cli.json editor composed with 2 pages:

  • Overview Page which provides a toolbar to run ng commands:

Angular CLI Editor

  • Source Page which uses WTP JSON Editor and provides completion:

Angular CLI Editor

.ember-cli

By default, when server is started with ng serve, it uses 4200 port and Live Reloading is enabled. If you wish to customize port of the server, disable Live Reloading, etc, you can do that with .ember-cli file that you must create at hand in your project root. This file is a JSON file and Angular2 Eclipse provides support for this file with completion:

Ember CLI Editor