Reputation: 1205
In my Angular app I'm getting the error below only in aot build.
You provided an invalid object where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.
and after debugging the ERROR saying is it's somewhere in the below codes
<ng-template #leftNavbar>
<cust-sidebar name="navbar"
[folded]="false"
lockedOpen="gt-md"
*ngIf="!conf.layout.navbar.hidden">
<navbar class="left-navbar" [ngClass]="conf.layout.navbar.background" layout="vertical"></navbar>
</cust-sidebar>
</ng-template>
and the ERROR also pointing to the the code below in ngOnInit
of cust-sidebar
this._custConfigService.config
.pipe(takeUntil(this._unsubscribeAll))
.subscribe((config) => {
this._conf = config;
});
this is my config service code for getting and setting config
set config(value)
{
let config = this._configSubject.getValue();
config = _.merge({}, config, value);
this._configSubject.next(config);
}
get config(): any | Observable<any>
{
return this._configSubject.asObservable();
}
what's wrong with my code and why I'm only getting it in --aot build not in normal build.
He is saying that he was having two different version of CLI and after changing the CLI version it worked for him, I also have two different version of CLI but that is not a problem I think?
Upvotes: 1
Views: 4245
Reputation: 1205
I got the issue thanks,
The error happened because I was importing the takeUntil
from rxjs/internal/operators
after I change the import to rxjs/operators
the problem was solved.
Now I'm confused, if one import is working in development it also should work in production otherwise angular should stick to one import file instead making people confuse.
Upvotes: 1