2016-05-05 41 views
1

我得到这个错误,我弄不清楚什么是错误的,代码是相同的,并在Angular 2 Beta 17中工作。我做的都正确,我检查了Angular2网站几次。Angular 2 RC1升级后发现没有指令注释

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(…) 
+0

请包括发生此错误的相关代码 – Austin

回答

1

的问题是,我并没有取代所有的import语句。

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

我更正了导入,现在所有工作都正常。

+0

您的导入有什么问题?我觉得我有同样的问题。 –

+0

只是没有输入正确的,多数民众赞成在所有。 – Teddy