我是Angular路由的新手,并将软件包从
注入到我的Ionic项目中npm i @angular/router
但是将我的appRoutes注入app.modules.ts
后几乎没有错误RouterModule.forRoot(
appRoutes,
{ enableTracing: true } // <-- debugging purposes only
),
这是我的应用路线
export const appRoutes: Routes = [
{ path: 'crisis-center', component: DocumentPage },
{ path: 'hero/:id', component: SchedulePage },
{
path: 'heroes',
component: MessagePage,
data: { title: 'Heroes List' }
},
{ path: '',
redirectTo: '/heroes',
pathMatch: 'full'
},
{ path: '**', component: WebsitePage }
];
错误
Uncaught Error: Can't resolve all parameters for createRouterScroller: ([object Object], ?, [object Object]).
at syntaxError (compiler.js:486)
at CompileMetadataResolver._getDependenciesMetadata (compiler.js:15706)
at CompileMetadataResolver._getFactoryMetadata (compiler.js:15558)
at CompileMetadataResolver.getProviderMetadata (compiler.js:15889)
at compiler.js:15792
at Array.forEach (<anonymous>)
at CompileMetadataResolver._getProvidersMetadata (compiler.js:15752)
at compiler.js:15224
at Array.forEach (<anonymous>)
at CompileMetadataResolver.getNgModuleMetadata (compiler.js:15215)
答案 0 :(得分:0)
将Angular 5升级到Angular 7,并将typscript @ latest和appscript升级到3.2.3之后,它可以正常工作。尽管必须创建一个新项目才能使该项目识别Angular-Routing。