Skip to content

Angular 2 project - Start from scratch

License

Notifications You must be signed in to change notification settings

king-prawns/Angular2-SFS

Repository files navigation

Angular2-SFS

Angular 2 project - Start from scratch

Installation

  • Install Node.js

Go to Node website

A simple CLI for scaffolding Angular 2 projects

$ npm install -g angular-cli

Full fake REST API

$ npm install -g json-server

Usage

  • Clone or Download the project

  • Install dependencies

$ cd my-project
$ npm install
  • Open first command prompt

a) for dev build

$ cd my-project
$ ng server

b) for prod build

$ cd my-project
$ ng build --prod

instead for AoT compilation:

$ ng build --prod --aot

Install http-server

A command-line http server

$ npm install -g http-server

then

$ cd my-project\dist
http-server
  • Open second command prompt
$ cd my-project\fake_db
$ json-server --watch db.json
  • Go to localhost

a) for dev build: localhost:4200

b) for prod build: localhost:8080

Features

Conclusion

This is just a simple example, I hope this will help you to understand better Angular 2.