在解析程序执行某些工作时,是否可以显示微调框而不是空白页?
我有一个带有两个解析器的模块:
const routes: Routes = [
{
path: '',
component: MyComponent,
canActivate: [MyAuthGuard],
resolve: {
vehicles: FirstResolve,
drivers: SecondResolve
},
children: [
{
path: '',
component: FirstComponent
},
{
path: ':id',
component: SecondComponent
}
]
}
];
每个解析程序都会执行一些耗时的操作,例如对服务器的请求:
@Injectable()
export class FirstResolve implements Resolve<Entity[]>{
constructor(
private _firstService: FirstService,
private _secondService: SecondService,
private _store: Store<any>
) { }
async resolve(): Promise<Entity[]> {
let data = await Promise.all([
this._firstService.getEntities(),
this._secondService.getEntities()
]);
this._store.dispatch(...);
this._store.dispatch(...);
return;
}
}
您能帮我弄清楚吗?