我正在做一个简单的 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 { }
最佳答案
Angular-cli从 beta.14
开始,他们将系统从 SystemJS 更改为 Webpack。不过,您似乎仍在使用 SystemJS。
您可以在 these instructions 之后迁移到 Webpack .但是,由于您只是在学习教程,我建议您 install angular-cli from scratch .
关于javascript - Angular 2 应用程序组件未加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40564582/