0

我正在使用社交应用教程来学习Angular2Meteor。我遇到了一个我找不到根本原因的问题。

我正在关注一个说明要添加的教程:

RouteConfig注解:

@RouteConfig([
  { 
    path: '/', 
    as: 'PartiesList', 
    component: PartiesList 
  }, { 
    path: '/party/:partyId', 
    as: 'PartyDetails', 
    component: PartyDetails 
  }
]);

router-outlet在 app.html 中:

<router-outlet></router-outlet>

在 Chrome 中加载应用程序时出现此异常:

EXCEPTION: Error in /client/app.html:0:0BrowserDomAdapter.logError @ 
modules.js?hash=12bd683…:59337BrowserDomAdapter.logGroup @ modules.js?
hash=12bd683…:59347ExceptionHandler.call @ modules.js?
hash=12bd683…:48750(anonymous function) @ modules.js?
hash=12bd683…:54194ZoneDelegate.invoke @ modules.js?
hash=12bd683…:107413onInvoke @ modules.js?
hash=12bd683…:54615ZoneDelegate.invoke @ modules.js?
hash=12bd683…:107412Zone.run @ modules.js?
hash=12bd683…:107306NgZoneImpl.runInner @ modules.js?
hash=12bd683…:54646NgZone.run @ modules.js?
hash=12bd683…:54538ApplicationRef_.run @ modules.js?
hash=12bd683…:54183ApplicationRef_.bootstrap @ modules.js?
hash=12bd683…:54205(anonymous function) @ modules.js?
hash=12bd683…:53993(anonymous function) @ meteor.js?
hash=ae8b8af…:1105ZoneDelegate.invoke @ modules.js?
hash=12bd683…:107413onInvoke @ modules.js?
hash=12bd683…:54615ZoneDelegate.invoke @ modules.js?
hash=12bd683…:107412Zone.run 

...

modules.js?hash=12bd683…:59337 TypeError: Cannot read property 'annotations' 
of undefined
at RouteRegistry.configFromComponent (modules.js?hash=12bd683…:87825)
at new RootRouter (modules.js?hash=12bd683…:87151)
at routerFactory (modules.js?hash=12bd683…:89570)
at ReflectiveInjector_._instantiate (modules.js?hash=12bd683…:50544)
at ReflectiveInjector_._instantiateProvider (modules.js?hash=12bd683…:50473)
at ReflectiveInjector_._new (modules.js?hash=12bd683…:50462)
at ReflectiveInjectorDynamicStrategy.getObjByKeyId (modules.js?hash=12bd683…:50117)
at ReflectiveInjector_._getByKeyDefault (modules.js?hash=12bd683…:50642)
at ReflectiveInjector_._getByKey (modules.js?hash=12bd683…:50614)
at ReflectiveInjector_.get (modules.js?hash=12bd683…:50423)

如果我删除,@RouteConfig则不会发生异常,但没有任何内容明显显示,因为没有内容要呈现。知道是什么原因造成的吗?

4

2 回答 2

0

一段时间后,角度时间和流星时间提出了新版本,在撰写本文时可以开箱即用。我还偶然发现了如何安装软件包。您可以使用以下格式:

meteor npm install @angular/core

例如安装角核心包

于 2016-07-11T09:29:39.863 回答
0

@RouterConfig 仅适用于不推荐使用的路由器和 rc1 的早期版本。随着新版本的发布,3.0.0.apha.7它不再可用。阅读Routing & Navigation上的文档

一个示例用法是

export const DashboarRoutes = [
  {
    path: 'dashboard',
    component: DashboardComponent
  },
  ...
  e.t.c      
] 
export const routes: RouterConfig = [
...DashboardRoutes,
...UIRoutes
];

export const APP_ROUTER_PROVIDERS = [
   provideRouter(routes)
];


APP_ROUTER_PROVIDERS is then passed when bootstrapping main application
于 2016-06-20T15:20:52.770 回答