我正在做一个简单的角度2教程,但我只是'试图运行我的应用程序时'加载'。 这是我的index.html文件角度2应用程序组件不加载
<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>
app.component.ts
import { Component } from '@angular/core'; @Component({ selector: 'my-app', template: '' }) export class AppComponent { }
完整的代码在这里:https://github.com/trinajoy/angularcv
控制台中是否有错误? – echonax
你应该做npm install reflect-metadata和npm install reflect-portfinder。 –
在铬开发工具我得到以下错误 shim.min.js:2未捕获的SyntaxError:意外令牌< (为之前的代码线) 和index.html的 本地主机/:18未捕获的ReferenceError:系统没有定义(...) System.import('app')。catch(function(err){console.error(err);}); 和 directive_normalizer.js:92未被捕获的错误:模板解析错误:(...) - 但我不知道它指的是哪部分代码... – user6086008