Skip to content

Instantly share code, notes, and snippets.

@ianjosephwilson
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ianjosephwilson/f019a632bef1666838fb to your computer and use it in GitHub Desktop.
Save ianjosephwilson/f019a632bef1666838fb to your computer and use it in GitHub Desktop.
angularjs2 5 minute quickstart
/// <reference path="typings/angular2/angular2.d.ts" />
import {Component, View, bootstrap} from 'angular2/angular2';
// Annotation section
@Component({
selector: 'my-app'
})
@View({
template: '<h1>Hello {{ name }}</h1>'
})
// Component controller
class MyAppComponent {
name: string;
constructor() {
this.name = 'Alice';
}
}
tsc --watch -m commonjs -t es5 --emitDecoratorMetadata app.ts
app.ts(1,1): error TS6053: File 'typings/angular2/angular2.d.ts' not found.
app.ts(2,42): error TS2307: Cannot find external module 'angular2/angular2'.
message TS6042: Compilation complete. Watching for file changes.
<!-- index.html -->
<html>
<head>
<title>Angular 2 Quickstart</title>
<script src="https://github.jspm.io/jmcriffey/bower-traceur-runtime@0.0.87/traceur-runtime.js"></script>
<script src="https://jspm.io/system@0.16.js"></script>
<script src="https://code.angularjs.org/2.0.0-alpha.23/angular2.dev.js"></script>
</head>
<body>
<!-- The app component created in app.ts -->
<my-app></my-app>
<script>System.import('app');</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment