/*app.ts*/
/// <reference path="node_modules/angular2/ts/typings/node/node.d.ts"/> /// <reference path="node_modules/angular2/typings/browser.d.ts"/> import { bootstrap } from "angular2/platform/browser"; import { Component } from "angular2/core"; @Component({ selector: 'hello-world', template: ` <div> Hello world </div> ` }) class HelloWorld { } bootstrap(HelloWorld);
/*********************************************************************************/
/*tsconfig.json*/
{ "compilerOptions": { "target": "ES5", "module": "system", "moduleResolution": "node", "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "removeComments": false, "noImplicitAny": false }, "exclude": [ "node_modules" ] }
/*********************************************************************************/
/*index.html*/
<!doctype html> <html> <head> <title>First App - Hello world</title> <!-- Libraries --> <script src="node_modules/es6-shim/es6-shim.js"></script> <script src="node_modules/angular2/bundles/angular2-polyfills.js"></script> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="node_modules/rxjs/bundles/Rx.js"></script> <script src="node_modules/angular2/bundles/angular2.dev.js"></script> <!-- Stylesheet --> <link rel="stylesheet" type="text/css" href="styles.css"> </head> <body> <script> System.config({ packages: { app: { format: 'register', defaultExtension: 'js' } } }); System.import('app.js') .then(null, console.error.bind(console)); </script> <hello-world></hello-world> </body> </html>
/*********************************************************************************/
No comments:
Post a Comment