我使用社交應用教程學習Angular2和Meteor。我遇到了一個我找不到根本原因的問題。使用routeconfig時,無法讀取未定義的屬性'註釋'
我跟隨tutorial,指出補充:
RouteConfig
註釋:
@RouteConfig([
{
path: '/',
as: 'PartiesList',
component: PartiesList
}, {
path: '/party/:partyId',
as: 'PartyDetails',
component: PartyDetails
}
]);
在app.html router-outlet
:
<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
,則不會發生異常,但沒有顯示任何內容,因爲沒有內容需要顯示。任何想法可能會造成這種情況?
我應該使用什麼命令來獲得所需要的新的包?嘗試了你的建議,但組件未解決 – mmelsen
使用新的路由器3.0.0.apha.7,通過上面描述的設置,似乎組件正在返回未定義狀態。有任何想法嗎? – Colum
是的,返回undefined。 – twilliams