0

I have a very strange problem. Everything works fine without lazy loading (with aot).

I've done these steps to make my module laze loaded:

  1. Change in app routing: loadChildren: 'app/calls/calls.module#CallsModule',
  2. Check app - everything is fine
  3. Remove in app.module my module: @NgModule({ imports: [ // CallsModule, ], }) export class AppModule { }

  4. And then I got error:

app.component.html:10 ERROR TypeError: this.fullDataStream.filter is not a function

this.fullDataStream is rxjs/Subject.

I tried to replace .filter to .pipe(filter()) But my code is not working any more (ReplaySubject doesn't replay items).

What is wrong? Its' me or typescript/angular/angular-cli/rxjs bug? Angular 5.0.1 RxJS 5.5.2 Typescript 2.4.2 angular-cli 1.5.0 UPD: With imported CallModule, ReplaySubject doesn't replay value when lazy loading

Saturn
  • 362
  • 4
  • 22

1 Answers1

0

So there was two problems.

  1. filter actually should be used with pipe() wrapper. Don't know why it worked before

  2. My service was imported twice, that's why ReplaySubject doesn't replay items. new instance doesn't have any. Read more: Angular2 Lazy Loading Service being Instantiated Twice https://angular.io/guide/ngmodule-faq#q-why-bad

Saturn
  • 362
  • 4
  • 22