typescript 无法读取未定义的属性“visitExpression”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39936819/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cannot read property 'visitExpression' of undefined
提问by Ele
In my angular app at the startup point I'm facing this error:
在启动点的 angular 应用程序中,我遇到了这个错误:
Cannot read property visitExpression
of undefined
无法读取性能visitExpression
的undefined
What could be the problem?
可能是什么问题呢?
采纳答案by Ele
In my case, it was components with empty selectors.
就我而言,它是带有空选择器的组件。
回答by hagay
In my case, it was duplicate ,
in the Routes array in app.routing.ts
.
就我而言,它,
在app.routing.ts
.
You can use ,[\s]*,
as a Regular Expression search queryto find it in your routes to find two commas with (0 to many) white spaces in between them.
您可以将其,[\s]*,
用作正则表达式搜索查询,以在您的路线中查找它以查找两个逗号(0 到多个)之间的空格。
回答by Sai S
It was ',' in my case in app.module.tsfile.
就我而言,它是app.module.ts文件中的“,” 。
imports: [
BrowserModule,
**AppRoutingModule,,**
HttpClientModule,
Changed it to:
改为:
imports: [
BrowserModule,
**AppRoutingModule,**
HttpClientModule,
回答by srijib
For me it was ,, in the *-routing.module.ts
对我来说,在 *-routing.module.ts
path: 'shoplist',
children: [
{
path: '',
loadChildren: () => import('../shoplist/shoplist.module').then(m => m.ShoplistModule)
}
]
},, <------------------ this was the cause
{
path: 'notification',
children: [
{
path: '',
loadChildren: () => import('../notification/notification.module').then(m => m.NotificationModule)
}
]
},