将angular2
项目升级到RC5时遇到了一个大问题。将所有代码减少到最低限度以调试问题,但没有找到它的根。我的应用程序的每个请求都会导致以下错误消息(浏览器中的开发人员控制台):
EXCEPTION:./e class e_Host中的错误 - 内联模板0:0
原始例外:选择器“ng-component”与任何元素都不匹配
我的简化代码看起来像这样,我相信这是最基本的:
main.ts
///<reference path="../node_modules/typescript/lib/lib.es6.d.ts"/>
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AdminModule } from './component/admin/admin.module';
platformBrowserDynamic().bootstrapModule(AdminModule);
admin.module.ts
import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {TestComponent} from '../admin/test/test';
@NgModule({
declarations: [TestComponent],
providers: [],
imports: [BrowserModule],
bootstrap: [TestComponent],
})
export class AdminModule {
}
test.ts
import {Component} from '@angular/core';
@Component({
//templateUrl : 'public/component/admin/test/test.html',
template: '<h1>Hello World!</h1>',
directives: []
})
export class TestComponent {}
我对每条路径进行了两次和三次检查并包括它的有效性,到目前为止一切都很好。
我的npm
设置如下:
的package.json
{
"name": "Angular2Boilerplate",
"version": "0.1.0",
"description": "Angular2Boilerplate",
"main": "index.js",
"scripts": {
"test": "gulp test"
},
"dependencies": {
"@angular/common": "2.0.0-rc.5",
"@angular/compiler": "2.0.0-rc.5",
"@angular/core": "2.0.0-rc.5",
"@angular/forms": "0.3.0",
"@angular/http": "2.0.0-rc.5",
"@angular/platform-browser": "2.0.0-rc.5",
"@angular/platform-browser-dynamic": "2.0.0-rc.5",
"@angular/router": "3.0.0-rc.1",
"@angular/router-deprecated": "2.0.0-rc.2",
"@angular/upgrade": "2.0.0-rc.5",
"angular2-localstorage": "^0.3.0",
"systemjs": "0.19.27",
"es6-promise": "^3.0.2",
"es6-shim": "^0.33.3",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "^0.6.12",
"primeng": "^1.0.0-beta.8",
"primeui": "^4.1.12"
},
"devDependencies": {
"browser-sync": "^2.10.0",
"del": "^2.2.0",
"gulp": "^3.8.11",
"gulp-clean": "^0.3.2",
"gulp-concat": "^2.6.0",
"gulp-debug": "^2.0.1",
"gulp-inject": "^1.2.0",
"gulp-rimraf": "^0.1.1",
"gulp-sass": "^2.1.1",
"gulp-sass-glob-import": "^0.1.0",
"gulp-sourcemaps": "^1.5.1",
"gulp-tslint": "^1.4.4",
"gulp-typescript": "^2.5.0",
"gulp-uglify": "^1.5.1",
"superstatic": "^3.0.0",
"typescript": "^1.8.10"
},
"keywords": [
"angular2",
"typescript",
"sass",
"gulp"
],
"author": "André Kirchner",
"license": "MIT"
}
尝试了我能想象的一切来追查问题,但现在我需要你的帮助。有没有人知道什么是goig如此严重错误?