{}

Angular 4 CLI commands

Install the Angular CLI

npm install -g @angular/cli

Create a new application

ng new angular-tour-of-heroes

Serve the application

cd angular-tour-of-heroes
ng serve --open

The ng serve command builds the app, starts the development server, watches the source files, and rebuilds the app as you make changes to those files.

The --open flag opens a browser to http://localhost:4200/.

Create a component

ng generate component heroes

Create a service

ng generate service hero --module=app

--module=app tells the CLI to register it in the imports array of the AppModule.

Add a module

ng generate module app-routing --flat --module=app

--flat puts the file in src/app instead of its own folder. 

Leave a comment