Core: rxjs.of is not a function

Created on 13 Jul 2018  路  13Comments  路  Source: ngx-translate/core

rxjs.of is not a function in file ngx-translate-core.umd.js. But the module works if I replace all occurrences of "rxjs.of" to "rxjs.Observable.of" it that file.

Most helpful comment

npm install [email protected]

help to solve my problem

All 13 comments

Do you use version ngx-translate 10 with angular 6?

Yes, right

Same Issue 'rxjs_Observable__WEBPACK_IMPORTED_MODULE_1__.Observable.of is not a function'..?
with angular 6.

Same issue:
TypeError: __WEBPACK_IMPORTED_MODULE_3_rxjs_Observable__.Observable.fromPromise is not a function Trace de la pile : JwtInterceptor.prototype.intercept@http://localhost:8100/build/vendor.js:93181:20 HttpInterceptorHandler.prototype.handle@http://localhost:8100/build/vendor.js:32056:16 PendingInterceptorService.prototype.intercept@http://localhost:8100/build/vendor.js:72495:16 HttpInterceptorHandler.prototype.handle@http://localhost:8100/build/vendor.js:32056:16 HttpXsrfInterceptor.prototype.intercept@http://localhost:8100/build/vendor.js:32660:20 HttpInterceptorHandler.prototype.handle@http://localhost:8100/build/vendor.js:32056:16 HttpInterceptingHandler.prototype.handle@http://localhost:8100/build/vendor.js:32707:16 HttpClient.prototype.request/events$<@http://localhost:8100/build/vendor.js:31893:172 MergeMapSubscriber.prototype._tryNext@http://localhost:8100/build/vendor.js:51643:22 MergeMapSubscriber.prototype._next@http://localhost:8100/build/vendor.js:51633:13 Subscriber.prototype.next@http://localhost:8100/build/vendor.js:25086:13 scalar/result<@http://localhost:8100/build/vendor.js:61481:9 Observable.prototype._trySubscribe@http://localhost:8100/build/vendor.js:25408:20 Observable.prototype.subscribe@http://localhost:8100/build/vendor.js:25394:17 MergeMapOperator.prototype.call@http://localhost:8100/build/vendor.js:51611:16 Observable.prototype.subscribe@http://localhost:8100/build/vendor.js:25389:13 FilterOperator.prototype.call@http://localhost:8100/build/vendor.js:51769:16 Observable.prototype.subscribe@http://localhost:8100/build/vendor.js:25389:13 MapOperator.prototype.call@http://localhost:8100/build/vendor.js:30156:16 Observable.prototype.subscribe@http://localhost:8100/build/vendor.js:25389:13 [1003]/CustomTranslateLoader.prototype.getTranslation/<@http://localhost:8100/build/main.js:126:20

Same here.
Angular: 6.1.4
ngx-translate: 10.0.2

ERROR TypeError: rxjs_Observable__WEBPACK_IMPORTED_MODULE_6__.Observable.of is not a function

Usually this error appears if you use rxjs4/5-compat syntax or operators with rxjs 6 that is required by Angular 6+.
You will need to change all occurrences of Observable.of to just "of" and use the proper import :)

I've just went very carefully through all my code, fixed all code to use proper rxjs6 syntax without compatibility fallbacks and the error is gone.

I've installed rxjs-compat.
It seems error is gone.

@pairmix this solve my issue

npm install [email protected]

help to solve my problem

I think that the problem is that you use the old standard for rxjs. rxjs updated to version 6 few months ago and did bring a lot of breaking changes with it. It did cost me a few days to rewrite a lot of code.

ngx-translate use since version x rxjs 6 (have to look it up in the changelog). This means that there will be errors when you compile your code due to the fact that rxjs does not support v5 code.

If you don't have a few days or not anough coffee, then you can use rxjs-compat to support V5 features with V6.

For more information:
rxjs migration
what changed?

angular 6.0.9
ngx-translate: 8.0.0

I also downgraded to 6.0.0 to make it work. Probably the software with which I work has not been migrated...

Update @ngx-translate/[email protected] to resolve that, For me.

npm install [email protected] worked for me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

crebuh picture crebuh  路  3Comments

madoublet picture madoublet  路  3Comments

ryanki1 picture ryanki1  路  4Comments

egornoveo picture egornoveo  路  4Comments

jvquarck picture jvquarck  路  3Comments