我已经将这一点减少到最基本的数据,我对于发生了什么感到困惑。我正在找到角度为2的选择器未找到错误。试图弄清楚问题是什么,它工作一小时前现在我已经添加了一个逗号或空格或做了一些事情来打破它我无法弄清楚我改变了什么! Arrrg
任何帮助表示赞赏!谢谢!
boot.ts
import {bootstrap} from 'angular2/platform/browser';
import {AppComponent} from './app.component';
bootstrap(AppComponent);
app.component.ts
import {Component} from 'angular2/core';
@Component({
selector: 'app',
template: `
<h1>component works!</h1>
`
})
export class AppComponent {
}
的index.html
<!doctype>
<html>
<head>
<base href="/">
<title>Angular 2 Boilerplate</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Load libraries -->
<!-- IE required polyfills, in this exact order -->
<script src="node_modules/es6-shim/es6-shim.min.js"></script>
<script src="node_modules/systemjs/dist/system-polyfills.js"></script>
<script src="node_modules/angular2/es6/dev/src/testing/shims_for_IE.js"> </script>
<script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="node_modules/rxjs/bundles/Rx.js"></script>
<script src="node_modules/angular2/bundles/angular2.js"></script>
<script src="node_modules/angular2/bundles/router.dev.js"></script>
<script src="node_modules/angular2/bundles/http.js"></script>
<link rel="stylesheet" href="src/css/app.css">
</head>
<body>
<my-app>Loading...</my-app>
<script>
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js'
}
}
});
System.import('app/boot')
.then(null, console.error.bind(console));
</script>
</body>
</html>
答案 0 :(得分:1)
在您的html文件中,您需要将<my-app>
更改为<app>
....
</head>
<body>
<app>Loading...</app> <!-- this should match your root component selector -->
<script>
....
答案 1 :(得分:0)
哦不,
我更改了选择器名称.. duuuh
在html中我需要将<my-app></my-app>
更改为<app></app>
,反之亦然。我在ts组件文件中更改了选择器名称之后就可以了。
UG ..