Angular

From The Travis van der Font Wiki
Jump to: navigation, search


Installing Angular CLI Globally
npm install -g @angular/cli
Create a new project
ng new PROJECT-NAME
Review Angular Version
ng version
Actively view app
ng serve
(must be inside project folder)

http://localhost:4200/

Actively view app (port change)
ng serve --host 0.0.0.0 --port 4201
Compile
ng build

Adding Features to Your Angular Application

You can use the ng generate command to add features to your existing application:

  • ng generate class my-new-class: add a class to your application
  • ng generate component my-new-component: add a component to your application
  • ng generate directive my-new-directive: add a directive to your application
  • ng generate enum my-new-enum: add an enum to your application
  • ng generate module my-new-module: add a module to your application
  • ng generate pipe my-new-pipe: add a pipe to your application
  • ng generate service my-new-service: add a service to your application

The generate command and the different sub-commands also have shortcut notations, so the following commands are similar:

  • ng g cl my-new-class: add a class to your application
  • ng g c my-new-component: add a component to your application
  • ng g d my-new-directive: add a directive to your application
  • ng g e my-new-enum: add an enum to your application
  • ng g m my-new-module: add a module to your application
  • ng g p my-new-pipe: add a pipe to your application
  • ng g s my-new-service: add a service to your application

Additional Reference(s):

www.sitepoint.com/ultimate-angular-cli-reference/

Supported Libraries: