加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

找不到外部模块’angular2 / angular2′ – Angular2 w / Typesc

发布时间:2020-12-17 07:43:52 所属栏目:安全 来源:网络整理
导读:我正在通过关于angular.io的一步一步的教程(角度2).我使用的是typcript.尝试编译时出现以下错误: 找不到外部模块’angular2 / angular2′ 使用watch命令. main.ts import {Component,View,bootstrap} from 'angular2/angular2';@Component({ selector: 'my-
我正在通过关于angular.io的一步一步的教程(角度2).我使用的是typcript.尝试编译时出现以下错误:

找不到外部模块’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为什么发生这个错误?

将这些文件添加到头部将为您提供最新的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>

资料来源:Angular.io: 5 Minute Quickstart

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读