Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eduardoluizgs/ca8a8b19f4b981d6f750302f7ef569d7 to your computer and use it in GitHub Desktop.
Save eduardoluizgs/ca8a8b19f4b981d6f750302f7ef569d7 to your computer and use it in GitHub Desktop.
Angular 2 - Start new project with angular-cli
# install angular cli
sudo npm install -g angular cli
# init new application
ng new app_name --routing
cd app_name
ng init app_name
# serve your application
ng serve
# or
ng serve --host 0.0.0.0 --port 4201
# or
npm start
# create a new component
ng generate component hello
ng g module hello --routing
# other commands
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
ng build
ng test: Run unit tests with karma
ng e2e: Run end-to-end tests with protractor
ng get: Gets values for project
ng set: Sets values for project
ng github-pages:deploy: Build the app for production, setup GitHub repo, and publish
ng lint: Run codelyzer to analyze code
ng format
ng doc
ng version: Get the version of the CLI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment