Solved: RangeError: Maximum call stack size exceeded when using valueChanges.subscribe

RangeError: Maximum call stack size exceeded when using valueChanges.subscribe

public tokenAcquired: BehaviorSubject<any> = new BehaviorSubject<any>('');

//from where you want to trigger the subscription
this.appService.tokenAcquired.next(tokenStored.accessToken);


//where you are subscribing

this.appService.tokenAcquired.pipe(
    distinctUntilChanged()) // it will emit if value is different then last
    .subscribe((token) => {
      if (this.debugMode) {
        console.log("token acquired and calling getApps.");
      }
      this.getApps();
    })

Comments

Popular posts from this blog

The serve command requires to be run in an Angular project, but a project definition could not be found - Fixed

Azure - Failed to deploy web package to App Service. Internal Server Error (CODE: 500)- Fixed

Your global Angular CLI version (8.3.3) is greater than your local version (1.6.5). The local Angular CLI version is used.