Thursday, 24 August 2017

Angular 2 or 4 startup project using CLI

Install Angular js2 or 4 https://cli.angular.io/

                            https://github.com/angular/angular-cli

CLI and generated project have dependencies that require Node 6.9.0 or higher, together with NPM 3 or higher.

So firstly we need to  install  node js: https://nodejs.org/en/download/

  1. Install the Angular CLI globally.
    Cmd=> npm install -g @angular/cli
  2. Create a new project
    Cmd=> ng new my-app
  3. Serve the application, Go to the project directory and launch the server
    Cmd=> cd my-app
    Cmd=> ng serve –open   OR  Cmd=> ng serve --host 0.0.0.0 --port 4201
Services using CLI in angular 2 or 4.

Use=>  localhost://4200

Component=> ng g component my-new-component
Directive=> ng g directive my-new-directive
Pipe=> ng g pipe my-new-pipe
Service=> ng g service my-new-service
Class=> ng g class my-new-class
Guard=> ng g guard my-new-guard
Interface=> ng g interface my-new-interface
Enum=> ng g enum my-new-enum
Module=> ng g module my-module


No comments:

Post a Comment