我的新Angular有一个包含3个小部件的仪表板。对于一个小部件(PreviousInquiriesComponent
),我想添加一个解析器,以使该小部件在数据准备就绪之前不显示。
children: [
{
path: '',
component: ProfileComponent,
outlet: 'outlet1'
},
{
path: '',
component: PreviousInquiriesComponent,
outlet: 'outlet2',
resolve: {
inquiries: InquiryResolver
},
},
{
path: '',
component: ProfileComponent,
outlet: 'outlet3'
}
]},```
But when I add the resolver, none of the widgets in the dashboard loads until data for that widget is ready. How can I solve this issue? Should I avoid using resolvers here?
答案 0 :(得分:0)
之所以出现此问题,是因为您要根据同一路线激活三个插座中的三个组件。如果这三个路线不同,则不会发生此问题。更改路由配置以具有不同的子路由,或者从此处删除解析。