本文介绍了找不到外部模块'angular2 / angular2' - Angular2瓦特/打字稿的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对angular.io(角2)经历了一步一步的教程。我使用的打字稿。我在尝试编译时,以下错误:
I am going through the step by step tutorial on angular.io (Angular 2). I am using typescript. I get the following error when trying to compile:
找不到外部模块'angular2 / angular2
使用watch命令。
main.ts
import {Component, View, bootstrap} from 'angular2/angular2';
@Component({
selector: 'my-app'
})
@View({
template: '<h1>My first Angular 2 App</h1>'
})
class AppComponent {
}
bootstrap(AppComponent);
的index.html
<!DOCTYPE html>
<html>
<head>
<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>
<my-app></my-app>
<script>
System.import('main');
</script>
</body>
</html>
问:为什么这个错误出现?
Q Why is this error occuring?
推荐答案
添加这些文件的头部会给你Angular2的最新工作版本。
Adding these files to the head will give you the latest working version of Angular2.
<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.26/angular2.dev.js"></script>
来源:
这篇关于找不到外部模块'angular2 / angular2' - Angular2瓦特/打字稿的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!