-
-
Notifications
You must be signed in to change notification settings - Fork 573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
three request on init #397
Comments
Hello, yes it should only send one request. Can you make a plunker with a reproduction of the problem? |
unfortunately this app is for a company so i can not put it on a plunker :( |
Did you load the TranslateModule in multiple ngModules and called .forRoot each time? |
here is the only ng module i have :
language.config.ts
and root component (app.component.ts)
language.service.ts
|
@ocombe
when you comment the setDefaultLang method out, it is loading just one .json file. |
I just noticed that I have the same problem on my project now that I implemented lazy loading, I'll see how to fix it and let you know. |
Ok so I used to call .forRoot in my shared module, and export TranslateModule from there, and configure the module in the constructor of the shared module. But apparently this was executed for each lazy loaded module that imported this shared module... |
Exactly, that's why it is called |
and that's why it's in the docs! |
But then again, who reads that :p? |
@ocombe would you please make a plunker ? at the moment this plunker is sending 2 requests for en.json |
Yes, that's a different problem though (but one I need to fix). |
Is the fix for this to only allow one request to me made a time? I'm happy to work on a PR for this if that is an approach you want to take. Or is the user just supposed to know not to call use and setDefaultLang for the same lang at the same time and this can be closed? |
Hi @ocombe, @SamVerschueren; I also noticed the same issue @deeg described. When I know it's maybe not among the priorities while there're tons of other job awaiting to be get done. Just want to let you know, I might come up with something useful when I find some time for it. |
Sorry I got busy at the end of last week. I'm hoping to get a fix in for this tomorrow or Monday. |
This stops multiple requests being made for the same lang file. It will now return the same observable when making duplicate requests for the same language. Closes ngx-translate#397
This stops multiple requests being made for the same lang file. It will now return the same observable when making duplicate requests for the same language. Closes ngx-translate#397
This stops multiple requests being made for the same lang file. It will now return the same observable when making duplicate requests for the same language. Fixes #397 Fixes #432 Fixes #447 Fixes Greentube/localize-router#26 Fixes #462
Also having this issue. |
@dgroh, , could you solve it? as? |
We are still having this issue in our app, even though we are running the latest (stable) Angular and ngx-translate version. If I comment out "setDefaultLang()" everything is fine, though. |
OK thanks! |
Still having the issue. AppModule imports I need |
Still having issue as well. Can we re-open this? |
I'm submitting a ... (check one with "x")
Current behavior
when app inits it sends three request for one json file
Expected/desired behavior
it should send one
Reproduction of the problem
Please tell us about your environment:
ng2-translate version: 5.0.0
Angular version: 2.3.1
Browser: [all ]
Language: [ TypeScript ]
The text was updated successfully, but these errors were encountered: