Angular 2 RC1“升级后未找到指令注释”

时间:2016-05-05 12:49:19

标签: typescript angular

我收到此错误,我无法弄清楚出了什么问题,代码是相同的并且在Angular 2 Beta 17中工作。我做得很好,我在Angular2网站上检查了几次。

ERROR

EXCEPTION: No Directive annotation found on AWebAppComponent
browser_adapter.ts:78EXCEPTION: No Directive annotation found on AWebAppComponentBrowserDomAdapter.logError @ browser_adapter.ts:78BrowserDomAdapter.logGroup @ browser_adapter.ts:89ExceptionHandler.call @ exception_handler.ts:53(anonymous function) @ application_ref.ts:345ZoneDelegate.invoke @ angular2-polyfills.js:349NgZoneImpl.inner.inner.fork.onInvoke @ ng_zone_impl.ts:67ZoneDelegate.invoke @ angular2-polyfills.js:348Zone.run @ angular2-polyfills.js:242NgZoneImpl.runInner @ ng_zone_impl.ts:99NgZone.run @ ng_zone.ts:210ApplicationRef_.run @ application_ref.ts:335coreLoadAndBootstrap @ application_ref.ts:101bootstrap @ platform_browser_dynamic.ts:105execute @ init.ts:15ensureEvaluated @ system.src.js:3317execute @ system.src.js:3435doDynamicExecute @ system.src.js:798link @ system.src.js:1000doLink @ system.src.js:652updateLinkSetOnLoad @ system.src.js:700(anonymous function) @ system.src.js:512ZoneDelegate.invoke @ angular2-polyfills.js:349Zone.run @ angular2-polyfills.js:242(anonymous function) @ angular2-polyfills.js:597ZoneDelegate.invokeTask @ angular2-polyfills.js:382Zone.runTask @ angular2-polyfills.js:282drainMicroTaskQueue @ angular2-polyfills.js:500ZoneTask.invoke @ angular2-polyfills.js:452
browser_adapter.ts:78STACKTRACE:BrowserDomAdapter.logError @ browser_adapter.ts:78ExceptionHandler.call @ exception_handler.ts:56(anonymous function) @ application_ref.ts:345ZoneDelegate.invoke @ angular2-polyfills.js:349NgZoneImpl.inner.inner.fork.onInvoke @ ng_zone_impl.ts:67ZoneDelegate.invoke @ angular2-polyfills.js:348Zone.run @ angular2-polyfills.js:242NgZoneImpl.runInner @ ng_zone_impl.ts:99NgZone.run @ ng_zone.ts:210ApplicationRef_.run @ application_ref.ts:335coreLoadAndBootstrap @ application_ref.ts:101bootstrap @ platform_browser_dynamic.ts:105execute @ init.ts:15ensureEvaluated @ system.src.js:3317execute @ system.src.js:3435doDynamicExecute @ system.src.js:798link @ system.src.js:1000doLink @ system.src.js:652updateLinkSetOnLoad @ system.src.js:700(anonymous function) @ system.src.js:512ZoneDelegate.invoke @ angular2-polyfills.js:349Zone.run @ angular2-polyfills.js:242(anonymous function) @ angular2-polyfills.js:597ZoneDelegate.invokeTask @ angular2-polyfills.js:382Zone.runTask @ angular2-polyfills.js:282drainMicroTaskQueue @ angular2-polyfills.js:500ZoneTask.invoke @ angular2-polyfills.js:452
browser_adapter.ts:78Error: No Directive annotation found on AWebAppComponent
    at new BaseException (exceptions.ts:14)
    at DirectiveResolver.resolve (directive_resolver.ts:54)
    at CompileMetadataResolver.getDirectiveMetadata (metadata_resolver.ts:82)
    at RuntimeCompiler.resolveComponent (runtime_compiler.ts:51)
    at eval (application_ref.ts:104)
    at eval (application_ref.ts:337)
    at ZoneDelegate.invoke (angular2-polyfills.js:349)
    at Object.NgZoneImpl.inner.inner.fork.onInvoke (ng_zone_impl.ts:67)
    at ZoneDelegate.invoke (angular2-polyfills.js:348)
    at Zone.run (angular2-polyfills.js:242)BrowserDomAdapter.logError @ browser_adapter.ts:78ExceptionHandler.call @ exception_handler.ts:57(anonymous function) @ application_ref.ts:345ZoneDelegate.invoke @ angular2-polyfills.js:349NgZoneImpl.inner.inner.fork.onInvoke @ ng_zone_impl.ts:67ZoneDelegate.invoke @ angular2-polyfills.js:348Zone.run @ angular2-polyfills.js:242NgZoneImpl.runInner @ ng_zone_impl.ts:99NgZone.run @ ng_zone.ts:210ApplicationRef_.run @ application_ref.ts:335coreLoadAndBootstrap @ application_ref.ts:101bootstrap @ platform_browser_dynamic.ts:105execute @ init.ts:15ensureEvaluated @ system.src.js:3317execute @ system.src.js:3435doDynamicExecute @ system.src.js:798link @ system.src.js:1000doLink @ system.src.js:652updateLinkSetOnLoad @ system.src.js:700(anonymous function) @ system.src.js:512ZoneDelegate.invoke @ angular2-polyfills.js:349Zone.run @ angular2-polyfills.js:242(anonymous function) @ angular2-polyfills.js:597ZoneDelegate.invokeTask @ angular2-polyfills.js:382Zone.runTask @ angular2-polyfills.js:282drainMicroTaskQueue @ angular2-polyfills.js:500ZoneTask.invoke @ angular2-polyfills.js:452
angular2-polyfills.js:349 Error: Error: No Directive annotation found on AWebAppComponent(…)

1 个答案:

答案 0 :(得分:1)

问题在于我没有替换所有的import语句。

导入不好时会发生此错误。

我纠正了进口并且现在都在工作。