Javascript 角度2应用程序组件未加载
我正在做一个简单的angular 2教程,但我只是在尝试运行我的应用程序时“加载”。 这是我的index.html文件Javascript 角度2应用程序组件未加载,javascript,angular,Javascript,Angular,我正在做一个简单的angular 2教程,但我只是在尝试运行我的应用程序时“加载”。 这是我的index.html文件 <html> <head> <title>Angular CV </title> <base href="/"> <meta charset="UTF-8"> <meta name="viewport" content="w
<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>
角CV
System.import('app').catch(函数(err){console.error(err);});
仍在加载。。。
app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: ''
})
export class AppComponent {
}
从'@angular/core'导入{Component};
@组成部分({
选择器:“我的应用程序”,
模板:“”
})
导出类AppComponent{
}
这里有完整的代码:将他们的系统从SystemJS更改为Webpack,从beta.14开始。不过,您似乎仍在使用SystemJS
您可以迁移到以下网页包。但是,由于您只是在学习教程,我建议您。控制台中有错误吗?您应该执行npm安装reflect metadata和npm安装reflect-portfinder。在chrome developer tools中,我收到以下错误shim.min.js:2 Uncaught SyntaxError:Unexpected token之前的代码行)对于index.html localhost/:18未捕获引用错误:未定义系统(…)System.import('app').catch(函数(err){console.error(err);});和指令_normalizer.js:92未捕获错误:模板解析错误:(…)-但我不确定它指的是代码的哪一部分…从您的github repo中,我认为您缺少systemjs.config.js
ok,我刚刚将systemjs.config.js添加到项目中,但应用程序仍然无法正确加载。它只是从我的index.html文件读取加载…我执行了以下npm卸载-g angular cli、npm cache clean、npm install-g angular-cli@latest,然后再次开始,但从我看到的情况来看,我的json文件中有相同的信息,还有angular cli json,我还是说到了同一点,其中我的应用程序仅显示“正在从索引文件加载”。。这里的完整代码:我在尝试一些教程时遇到了同样的问题,但是您仍然在尝试在index.html
(第17-19行)中导入SystemJS
(并且还尝试加载SystemJS脚本)。因此,im donig-npm uninstall-g angular cli,npm cache clean,npm安装-g-cli@latest-但仍然没有获得beta 14。。?我做得不对吗?事实上我想我修改了index.html以匹配我正在做的教程。。我想这就是问题所在。。