<!DOCTYPE html>
<html>

  <head>
    <base href="." />
    <title>Angular Playground</title>
    <script src="https://unpkg.com/zone.js@0.7.2/dist/zone.js"></script>
    <script src="https://unpkg.com/zone.js@0.7.2/dist/long-stack-trace-zone.js"></script>
    <script src="https://unpkg.com/reflect-metadata@0.1.8/Reflect.js"></script>
    <script src="https://unpkg.com/systemjs@0.19.41/dist/system.js"></script>
    <script src="config.js"></script>
    <script>
    System.import('app')
      .catch(console.error.bind(console));
  </script>
  </head>

  <body>
    <my-app>Loading...</my-app>
  </body>

</html>
### Angular Starter Plunker - Typescript

Adapted from http://plnkr.co/edit/tpl:AvJOMERrnz94ekVua0u5 to use fixed
versions for all dependencies.
System.config({
  //use typescript for compilation
  transpiler: 'typescript',
  //typescript compiler options
  typescriptOptions: {
    emitDecoratorMetadata: true
  },
  paths: {
    'npm:': 'https://unpkg.com/'
  },
  //map tells the System loader where to look for things
  map: {
    
    'app': './src',
    
    '@angular/core': 'npm:@angular/core@2.3.0/bundles/core.umd.js',
    '@angular/common': 'npm:@angular/common@2.3.0/bundles/common.umd.js',
    '@angular/compiler': 'npm:@angular/compiler@2.3.0/bundles/compiler.umd.js',
    '@angular/forms': 'npm:@angular/forms@2.3.0/bundles/forms.umd.js',
    '@angular/http': 'npm:@angular/http@2.3.0/bundles/http.umd.js',
    '@angular/platform-browser': 'npm:@angular/platform-browser@2.3.0/bundles/platform-browser.umd.js',
    '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic@2.3.0/bundles/platform-browser-dynamic.umd.js',
    '@angular/router': 'npm:@angular/router@3.3.0/bundles/router.umd.js',
    
    '@angular/core/testing': 'npm:@angular/core@2.3.0/bundles/core-testing.umd.js',
    '@angular/common/testing': 'npm:@angular/common@2.3.0/bundles/common-testing.umd.js',
    '@angular/compiler/testing': 'npm:@angular/compiler@2.3.0/bundles/compiler-testing.umd.js',
    '@angular/platform-browser/testing': 'npm:@angular/platform-browser@2.3.0/bundles/platform-browser-testing.umd.js',
    '@angular/platform-browser-dynamic/testing': 'npm:@angular/platform-browser-dynamic@2.3.0/bundles/platform-browser-dynamic-testing.umd.js',
    '@angular/http/testing': 'npm:@angular/http/bundles@2.3.0/http-testing.umd.js',
    '@angular/router/testing': 'npm:@angular/router/bundles@3.3.0/router-testing.umd.js',
    
    'rxjs': 'npm:rxjs@5.0.0-rc.4',
    'typescript': 'npm:typescript@2.1.4/lib/typescript.js'
  },
  //packages defines our app package
  packages: {
    app: {
      main: './main.ts',
      defaultExtension: 'ts'
    },
    rxjs: {
      defaultExtension: 'js'
    }
  }
});
import 'rxjs/add/operator/toPromise';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';

platformBrowserDynamic().bootstrapModule(AppModule)
import { Component } from '@angular/core';
import { PriceService } from './price.service';

@Component({
  selector: 'my-app',
  template: `
    <div>
      <h2>Bitcoin Price</h2>
      <p>1 BTC = {{ price }} {{ currency }}</p>
    </div>
  `,
})
export class AppComponent {

  currency = 'USD';
  price: number;
  
  constructor(priceService: PriceService) {
    priceService.getPrice(this.currency)
      .then(price => this.price = price);
  }

}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { HttpModule } from '@angular/http';
import { PriceService } from './price.service';
import { AppComponent } from './app.component';

@NgModule({
  imports: [ BrowserModule, HttpModule ],
  declarations: [ AppComponent ],
  providers: [ PriceService ],
  bootstrap: [ AppComponent ]
})
export class AppModule { }
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';

@Injectable()
export class PriceService {

  private currentPriceUrl = 'http://api.coindesk.com/v1/bpi/currentprice.json';

  constructor(private http: Http) { }

  getPrice(currency: string): Promise<number> {
    return this.http.get(this.currentPriceUrl).toPromise()
      .then(response => response.json().bpi[currency].rate);
  }

}