我在angular 5应用中使用ui路由器。我正在尝试调用后端,并等待其解析,然后再为该路由加载组件。但是,组件在解析完成之前会继续加载。关于我在做什么错的任何想法吗?
{
name: 'brochure',
url: '/brochure/{propertyId}',
component: PropertyBrochureComponent,
resolve: [
{
token: 'brochureResponse',
useFactory: (trans, dataService: MyDataService) => {
dataService.send(new BrochureRequest(trans.params().propertyId)).subscribe((data) => {
return data;
});
},
deps: [Transition, MyDataService]
}
]
}