小编yam*_*dvo的帖子

Angular 2旋转变压器带有加载指示器

我使用解析器将数据加载到组件中,但在数据未从服务器返回之前,组件不会加载.我想知道在服务器响应之前是否有一种方法来呈现负载指示器.

angular2-routing angular

21
推荐指数
2
解决办法
6766
查看次数

运算符管道的Rxjs错误

我在switchMap运算符中有错误:

@Injectable()
export class AvailableStoreTypesLoadedEffect {
constructor(private actions$: Actions,
          private service: AvailableService) {

}

 @Effect()
 AvailableStoreTypesLoadedEffect$ = this.actions$
 .ofType(FETCH_AVAILABLE_STORE_TYPES)
 .pipe(
   switchMap(action => this.service.fetchAvailableStoreTypes()),//Error:(22, 9) TS2684:The 'this' context of type 'void' is not assignable to method's 'this' of type 'Observable<{}>'.
   map(res => new AvailableStoreTypesLoaded(res))
  );
}
Run Code Online (Sandbox Code Playgroud)

我尝试过:

Observable.of({})
  .pipe(
    switchMap(() => Observable.of({}))//Error:(22, 9) TS2684:The 'this' context of type 'void' is not assignable to method's 'this' of type 'Observable<{}>'.
  );
Run Code Online (Sandbox Code Playgroud)

但我得到了同样的错误.

我的环境是:

  • 角5.0.3
  • 打字稿2.4.2
  • rxjs 5.5.2

rxjs angular

3
推荐指数
1
解决办法
1182
查看次数

标签 统计

angular ×2

angular2-routing ×1

rxjs ×1