/angular2-there-and-back-again

A little bit of everything in Angular 2

Primary LanguageTypeScript

Angular 2 - There and Back Again

Example with a most of the major Angular concepts.

Pre-Requisites

  1. Must install pre-requisites npm install typescript live-server tsd@0.6.5-beta.2 -g

Getting Started

  1. Run npm install

  2. Run the TypeScript compiler and watch for changes npm run tsc

  3. Open 2nd terminal and launch the app in the browser npm start

Notes

  • Add redirectTo and/or otherwise routes
  • Fix http as it evolves
  • Manual typings fix for Pipes angular/angular#4279
  • Update to use tsd 0.6.5 when out of beta

From Scratch

(draft)

  1. Create empty package.json

    npm init -y
  2. Install npm packages

    npm install --save angular2 systemjs traceur
  3. Make a source folder

    mkdir -p src/app
  4. Install typings files

    tsd install angular2 -rosa --config src/tsd.json
  5. Create a tsconfig.json file, in an editor

    {
    	"compilerOptions": {
    		"target": "ES5",
    		"module": "commonjs",
    		"sourceMap": true,
    		"emitDecoratorMetadata": true,
    		"experimentalDecorators": true,
    		"removeComments": false,
    		"noImplicitAny": true
    	}
    }
  6. Create app.ts and enter

    import {bootstrap, Component, View} from 'angular2/angular2';
    
    @Component({
    	selector: 'app'
    })
    @View({
    	template: '<h1>Dashboard</h1>'
    })
    export class AppComponent { }
    
    bootstrap(AppComponent);