UI路由器2在解决之前不等待订阅解析

时间:2018-10-04 18:04:29

标签: angular angular-ui-router

我在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]
  }
 ]
}

0 个答案:

没有答案