Useful Angular Commands with Angular CLI & Visual Studio 2017

1, New Service: ng g s mynewservice –module=app.module

2, New Component : ng g c mynewcomponent –-module=app.module / ng g c mynewcomponent –-module=app.module   -flat (Here –flat will not create a new directory)

3, New Class: ng g cl User

4, New Interface: ng g i Account

5, Install Angular CLI globally by going to C Drive C:\ npm install -g @angular/[email protected]est

6, Install Angular CLI as a dev dependency by going to project root folder(Administrator mode) C:\Users\Asish\source\repos\AngularApp\AngularApp npm install –save-dev @angular/[email protected]

7, Create new Angular project : ng new projectname

8, Executing a project: ng serve

ng g c— Generates a new component.
ng g s— Generates a new service.
ng g d— Generates a new directive.
ng g m— Generates a new module.
ng g application— Generates a new app within the same project.
This command was introduced in Angular 6.
ng g library— Starting with Angular 6, you can generate a library
project.

Add Comment