2
votes

I am using angular material spinner in my project but , It shows this

ERROR in node_modules/rxjs-compat/operator/shareReplay.d.ts(2,10): error TS2305: Module '"D:/ControlCenter/ofservices/node_modules/rxjs/internal-compatibility/index"' has no exported member 'ShareReplayConfig'.

I am getting this error :

ERROR in node_modules/rxjs-compat/operator/shareReplay.d.ts(2,10): error TS2305: Module '"D:/ControlCenter/ofservices/node_modules/rxjs/internal-compatibility/index"' has no exported member 'ShareReplayConfig' `

Can anyone help me???

spinner.service.ts file

import { Injectable } from '@angular/core';
import { Observable, Subject } from 'rxjs/Rx';
export interface ISpinnerState {
  show: boolean
}

@Injectable()
export class SpinnerService {
  private _spinnerSubject = new Subject();

spinnerState = <Observable<ISpinnerState>>this._spinnerSubject.asObservable();
  show() {
    this._spinnerSubject.next(<ISpinnerState>{ show: true });
  }
  hide() {
    this._spinnerSubject.next(<ISpinnerState>{ show: false });
  }
}

spinner.component.ts

import {Component, OnDestroy, OnInit} from '@angular/core';
import { Subscription } from 'rxjs/Rx';
import {  ISpinnerState, SpinnerService } from './services/spinner.service';
@Component({
  selector: 'loading-spinner',
  template: `
  <div *ngIf="visible"
  class="spinner">
</div>
  `,
  styles: [`.spinner {position: absolute;left: 46%;top: 12%;background-color:black;width:50px;height:50px}`]
})

export class SpinnerComponent implements OnDestroy, OnInit {
  visible = false;

  private _spinnerStateChanged: Subscription;

  constructor(private _spinnerService: SpinnerService) { }

  ngOnInit() {
    this._spinnerStateChanged = this._spinnerService.spinnerState
      .subscribe((state: ISpinnerState) => this.visible = state.show);
  }
  ngOnDestroy() {
    this._spinnerStateChanged.unsubscribe();
  }
}
1

1 Answers

3
votes

Try this version to see if it work for you

"rxjs": "6.3.3", 
"rxjs-compat": "6.3.3",