javascript - Angular 2 应用程序组件未加载

标签 javascript angular

我正在做一个简单的 Angular 2 教程,但我在尝试运行我的应用程序时只是“正在加载”。 这是我的 index.html 文件

 <html>
      <head>
        <title>Angular CV </title>
        <base href="/">
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="styles.css">
        <!-- 1. Load libraries -->
         <!-- Polyfill for older browsers -->
        <script src="node_modules/core-js/client/shim.min.js"></script>
        <script src="node_modules/zone.js/dist/zone.js"></script>
        <script src="node_modules/reflect-metadata/Reflect.js"></script>
        <script src="node_modules/systemjs/dist/system.src.js"></script>
        <!-- 2. Configure SystemJS -->
        <script src="systemjs.config.js"></script>
        <script>
          System.import('app').catch(function(err){ console.error(err); });
        </script>
      </head>
      <!-- 3. Display the application -->
      <body>
        <my-app>Still Loading...</my-app>
      </body>
    </html>

应用程序组件.ts


    import { Component } from '@angular/core';

    @Component({
      selector: 'my-app',
      template: ''
    })
    export class AppComponent {

    }

完整代码在这里:https://github.com/trinajoy/angularcv

最佳答案

Angular-clibeta.14 开始,他们将系统从 SystemJS 更改为 Webpack。不过,您似乎仍在使用 SystemJS。

您可以在 these instructions 之后迁移到 Webpack .但是,由于您只是在学习教程,我建议您 install angular-cli from scratch .

关于javascript - Angular 2 应用程序组件未加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40564582/

相关文章:

Angular ngrx 存储了解 Reselect 的返回值

javascript - 使用 jQuery PHP 将图像替换为图像后刷新图像

javascript - 为什么 ng-bind-html 只显示文本而不显示链接?

angular - 如何通过 Angular 5 中的 `httpclient` 删除请求传递正文

html - 如何在 ionic 中获取输入文本值

angularjs - ngUpgrade 性能注意事项

javascript - 如何处理 firebase 托管中的动态链接?

javascript - 将箭头指向位置(地理位置)

javascript - PHP代码执行并防止未经授权的外部访问执行

html - 如何将 ionic 图标放置在 ionic HTML 移动用户界面的文本字段中?