Angular 2 project - Start from scratch
- Install Node.js
Go to Node website
- Install angular-cli
A simple CLI for scaffolding Angular 2 projects
$ npm install -g angular-cli
- Install json-server
Full fake REST API
$ npm install -g json-server
-
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
- made following Angular 2 Style Guide
- component, service, directive, pipe
- Shared and Core Modules
- RxJS Observable
- include 3rd-party JS library
- Lazy Loading
- JiT and AoT Compilation
- Animations
- Webpack
- Normalize
- Angular 2 Bootstrap
- Angular 2 i18n
- Angular 2 Codelyzer
- NO unit/integration test has been developed
This is just a simple example, I hope this will help you to understand better Angular 2.