我究竟做错了什么?
app.component.ts
import {Component} from 'angular2/core';
@Component({
selector: 'my-app',
template: `{{title}}`
})
export class App {
title = "Angular 2 beta";
constructor() { console.clear(); }
}
主要
import {bootstrap} from 'angular2/platform/browser';
import {AppComponent} from './app.component';
bootstrap(AppComponent);
错误是
EXCEPTION: TypeError: Cannot read property 'annotations' of undefined
类名与您引导的名称不匹配。即,而不是
export class App { ... }
使用
export class AppComponent { ... }
Angular试图找到annotations
名为的类的属性AppComponent
,但该类不存在,因此会出现错误。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句