Javascript 如何使用CDN和SystemJS加载angular2

Javascript 如何使用CDN和SystemJS加载angular2,javascript,typescript,angular,Javascript,Typescript,Angular,在我的index.html文件中,我通过cdn加载angular 2,但似乎因为我导入了angular 2系统的模块,JS认为我必须在本地拥有它们,我如何解决这个问题 <html> <head> <base href="/"> <title>Angular 2 Arc</title> <link rel="icon" type="image/x-icon" href="favicon.ico">

在我的index.html文件中,我通过cdn加载angular 2,但似乎因为我导入了angular 2系统的模块,JS认为我必须在本地拥有它们,我如何解决这个问题

<html>
<head>
    <base href="/">
    <title>Angular 2 Arc</title>
    <link rel="icon" type="image/x-icon" href="favicon.ico">
    <meta name="viewport" content="width=device-width, initial-scale=1">
</head>

<body>
  <ng2-app>Loading...</ng2-app>
  <!-- Load Angular 2 Core libraries -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.24/system.js"></script>
  <script src="https://npmcdn.com/rxjs@5.0.0-beta.2/bundles/Rx.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/2.0.0-beta.9/angular2-polyfills.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/2.0.0-beta.9/angular2.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/2.0.0-beta.9/http.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/2.0.0-beta.9/router.min.js"></script>
  <script src="https://npmcdn.com/angular2@2.0.0-beta.9/es6/dev/src/testing/shims_for_IE.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.0/es6-shim.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.20/system-polyfills.js"></script>
  <script src="https://code.angularjs.org/tools/system.js.map"></script>

  <!-- Load Bootstrap and Jquery -->
  <script src="lib/jquery/jquery.min.js" charset="utf-8"></script>
  <script src="lib/bootstrap/js/bootstrap.min.js" charset="utf-8"></script>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.0/gh-fork-ribbon.min.css" />
  <link rel="stylesheet" href="/lib/bootstrap/css/bootstrap.min.css" media="screen" title="no title" charset="utf-8">
  <link rel="stylesheet" href="assets/css/app.css">
  <!-- Configure SystemJS -->
  <script>
      System.config({
          defaultJSExtensions: true,
          packages: {
              boot: {
                  format: 'register',
                  defaultExtension: 'js'
              }
          }
      });
      System.import('js/boot')
              .then(null, console.error.bind(console));
  </script>
</body>
</html>

角2弧
加载。。。
System.config({
defaultJSExtensions:true,
套餐:{
启动:{
格式:'寄存器',
defaultExtension:'js'
}
}
});
System.import('js/boot')
.then(null,console.error.bind(console));

使用SystemJS,您可以提供从不同位置加载模块的映射

SystemJS.config({
  map: {
       '@angular': 'https://npmcdn.com/@angular'
   }
});
这将把模块@angular的所有加载重定向到该cdn位置


有关更多详细信息,请在此查看
systemjs.config.js
,了解更多详细信息

您有什么确切错误?实际上它需要我在组件中使用的所有文件,但需要本地文件。所以它的文件没有发现404错误,对于http.js,common.js,core等等,我注意到了一些奇怪的东西。你能到这里用开发工具检查一下网络吗?它用system.src.js
https://angular2arc.herokuapp.com/
因此需要花费大量时间加载。您能提供一个plunkr吗?谢谢我不知道如何将我的目录上传到plunker,这可能吗?我可以给你一个github回购协议吗?