0
我收到以下错误:如何使用Angular 2编译Typescript?
Error:(7, 5) TS1148: Cannot compile modules unless the '--module' flag is provided.
Error:(7, 40) TS2307: Cannot find module 'angular2/angular2'.
Error:(8, 5) TS1205: Decorators are only available when targeting ECMAScript 5 and higher.
Error:(12, 11) TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning.
不知道该怎么做。我已经尝试了Angular网站上的快速入门教程,下面是我的代码。我认为有些事情需要与打字稿一起完成,但是什么?
app.ts
import {Component, bootstrap} from 'angular2/angular2';
@Component({
selector: 'my-app',
template: '<h1>My First Angular 2 App</h1> <p>hello</p>'
})
class AppComponent { }
自举(AppComponent);
的index.html
<html>
<head>
<title>Angular 2 QuickStart</title>
<script src="https://code.angularjs.org/tools/system.js"></script>
<script src="https://code.angularjs.org/tools/typescript.js"></script>
<script src="https://code.angularjs.org/2.0.0-alpha.44/angular2.dev.js"></script>
<script>
System.config({
transpiler: 'typescript',
typescriptOptions: { emitDecoratorMetadata: true }
});
System.import('./app.ts');
</script>
</head>
<body>
<my-app>loading...</my-app>
</body>
</html>