<!DOCTYPE html>
<html>
<head>
<title>angular2 playground</title>
<link rel="stylesheet" href="style.css" />
<script src="https://npmcdn.com/zone.js@0.6.12/dist/zone.js"></script>
<script src="https://npmcdn.com/reflect-metadata@0.1.3/Reflect.js"></script>
<script src="https://npmcdn.com/systemjs@0.19.31/dist/system.js"></script>
<script src="https://npmcdn.com/typescript@1.8.10/lib/typescript.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>
/* Styles go here */
### Angular2 Starter Plunker - Typescript - RC.0
A simple plunker demonstrating Angular2 usage:
- Uses SystemJS + TypeScript to compile on the fly
- Includes binding, directives, http, pipes, and DI usage.
System.config({
//use typescript for compilation
transpiler: 'typescript',
//typescript compiler options
typescriptOptions: {
emitDecoratorMetadata: true
},
//map tells the System loader where to look for things
map: {
app: "./src",
'@angular': 'https://cdn.rawgit.com/angular',
'@angular/core': 'https://cdn.rawgit.com/angular/core-builds',
'@angular/common': 'https://cdn.rawgit.com/angular/common-builds',
'@angular/compiler': 'https://cdn.rawgit.com/angular/compiler-builds',
'@angular/platform-browser': 'https://cdn.rawgit.com/angular/platform-browser-builds',
'@angular/platform-browser-dynamic': 'https://cdn.rawgit.com/angular/platform-browser-dynamic-builds',
'rxjs': 'https://npmcdn.com/rxjs@5.0.0-beta.6'
},
//packages defines our app package
packages: {
app: {
main: './main.ts',
defaultExtension: 'ts'
},
'@angular/core': {
main: '2.0.0-933f45e/bundles/core.umd.js',
defaultExtension: 'js'
},
'@angular/compiler': {
main: '2.0.0-933f45e/bundles/compiler.umd.js',
defaultExtension: 'js'
},
'@angular/common': {
main: '2.0.0-933f45e/bundles/common.umd.js',
defaultExtension: 'js'
},
'@angular/platform-browser-dynamic': {
main: '2.0.0-933f45e/bundles/platform-browser-dynamic.umd.js',
defaultExtension: 'js'
},
'@angular/platform-browser': {
main: '2.0.0-933f45e/bundles/platform-browser.umd.js',
defaultExtension: 'js'
},
rxjs: {
defaultExtension: 'js'
}
}
});
//main entry point
import {bootstrapWorkerUi} from '@angular/platform-browser-dynamic';
import {App} from './app';
bootstrapWorkerUi("loader.js");
//our root app component
import {Component} from '@angular/core'
@Component({
selector: 'my-app',
providers: [],
template: `
<div>
<h2>Hello {{name}}</h2>
</div>
`,
directives: []
})
export class App {
constructor() {
this.name = 'Angular2 (Release Candidate!)'
}
}
importScripts("https://code.angularjs.org/2.0.0-beta.17/angular2-polyfills.js",
"https://code.angularjs.org/tools/system.js",
"https://code.angularjs.org/tools/typescript.js",
"config.js");
System.import("./src/main-background");
//main entry point
import {bootstrapWorkerApp} from '@angular/platform-browser-dynamic';
import {App} from './app';
console.log("loader is running");
bootstrapWorkerApp(App, []).catch(err => console.error(err));