-
Notifications
You must be signed in to change notification settings - Fork 69
Error: URLs requested via Http on the server must be absolute. #24
Comments
The actual error spit by Universal is:
I am also experiencing it. |
ngx-universal (UniversalTranslateLoader) won't work for Angular 5. See fulls1z3/ngx-translate#44. |
As per the docs https://angular.io/guide/universal#using-absolute-urls-for-http-data-requests-on-the-server, it says-
But this is not working (in export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader {
return new TranslateHttpLoader(http);
} TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient]
},
}), Here is the error- ERROR NetworkError
at XMLHttpRequest3.send (/Users/shashank/Projects/bharat-post/web-app/dist/web-app/server/main.js:1:2445465)
at Observable2._subscribe (/Users/shashank/Projects/bharat-post/web-app/dist/web-app/server/main.js:1:336270)
at Observable2._trySubscribe (/Users/shashank/Projects/bharat-post/web-app/dist/web-app/server/main.js:1:2091056)
at Observable2.subscribe (/Users/shashank/Projects/bharat-post/web-app/dist/web-app/server/main.js:1:2090838)
at scheduleTask (/Users/shashank/Projects/bharat-post/web-app/dist/web-app/server/main.js:1:4334513)
at Observable2._subscribe (/Users/shashank/Projects/bharat-post/web-app/dist/web-app/server/main.js:1:4335116)
at Observable2._trySubscribe (/Users/shashank/Projects/bharat-post/web-app/dist/web-app/server/main.js:1:2091056)
at Observable2.subscribe (/Users/shashank/Projects/bharat-post/web-app/dist/web-app/server/main.js:1:2090838)
at innerSubscribe (/Users/shashank/Projects/bharat-post/web-app/dist/web-app/server/main.js:1:2111774)
at MergeMapSubscriber._innerSub (/Users/shashank/Projects/bharat-post/web-app/dist/web-app/server/main.js:1:2141009) Having the latest dependencies- "@angular/common": "~12.2.5",
"@angular/compiler": "~12.2.5",
"@angular/core": "~12.2.5",
"@nguniversal/express-engine": "^12.1.0",
"@ngx-translate/core": "^13.0.0",
"@ngx-translate/http-loader": "^6.0.0", Although, adding the path resolves the problem |
EDIT: nevermind, just use ngx-universal, since I'm using Universal (hope I solve the
Cannot resolve 'fs' module
thing).Writing this
rather than this
leads to
Error: Uncaught (in promise).
It would be nice to have an automatic way to retrieve the origin. Or I'm missing something.The text was updated successfully, but these errors were encountered: