Last active
August 29, 2015 14:22
-
-
Save ianjosephwilson/f019a632bef1666838fb to your computer and use it in GitHub Desktop.
angularjs2 5 minute quickstart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <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'; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- index.html --> | |
<html> | |
<head> | |
<title>Angular 2 Quickstart</title> | |
<script src="https://github.jspm.io/jmcriffey/[email protected]/traceur-runtime.js"></script> | |
<script src="https://jspm.io/[email protected]"></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