Created
April 20, 2015 17:38
-
-
Save alexeagle/24243fbb87dbd8bad6f1 to your computer and use it in GitHub Desktop.
This file contains 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
cd TypeScript | |
git reset --hard 62b15de666fbce283b97f1f99c2f799d04a8e0b5 # HEAD from master | |
npm install reflect-metadata | |
rm -rf built && jake | |
node built/local/tsc.js test.ts -t es6 --emitDecoratorMetadata | |
npm install -g babel | |
babel test.js > app_bin.js | |
# load test.html in browser |
This file contains 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
<!doctype html> | |
<html> | |
<head> | |
<script src="node_modules/reflect-metadata/Reflect.js"/> | |
<script src="//code.angularjs.org/2.0.0-alpha.19/angular2.sfx.dev.js"></script> | |
</head> | |
<body> | |
<todo-app> | |
Loading... | |
</todo-app> | |
<script src="app_bin.js"></script> | |
</body> | |
</html> |
This file contains 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
var angular = window.angular; | |
class Service { | |
greeting() { | |
return 'Hello'; | |
} | |
} | |
@angular.Component({ | |
selector: 'app', | |
injectables: [Service] | |
}) | |
@angular.View({ | |
template: '{{greeting}} world!' | |
}) | |
class App { | |
private greeting; | |
static parameters; | |
constructor(service: Service) { | |
this.greeting = service.greeting(); | |
setTimeout(() => this.greeting = 'Howdy,', 1000); | |
} | |
} | |
App.parameters = window.Reflect.getMetadata('design:paramtypes', App).map((p) => [p]); | |
angular.bootstrap(App); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment