question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error loading json

See original GitHub issue

I’m submitting a … (check one with “x”)

[ ] bug report => check the FAQ and search github for a similar issue or PR before submitting

Current behavior Unable to set folder. provide, useFactory and deps are undefined TranslateModule.forRoot({ provide: TranslateLoader, useFactory: (http: Http) => new TranslateStaticLoader(http, ‘/i18n’, ‘.json’), deps: [Http] })

Expected/desired behavior Should able to get file. I don’t know it loads i18n in url

Reproduction of the problem If the current behavior is a bug or you can illustrate your feature request better with an example, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar (you can use this template as a starting point: http://plnkr.co/edit/tpl:btpW3l0jr5beJVjohy1Q).

What is the expected behavior?

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

  • ng2-translate version: x.x.x

  • Angular version: 2.0.0-rc.X

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

  • Language: [all | TypeScript X.X | ES6/7 | ES5]

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
SamVerschuerencommented, Jan 20, 2017

It tries to load the translation file from i18n instead of from assets/i18n. Make sure you configured the translate loader correctly. See the documentation.

export function createTranslateLoader(http: Http) {
    return new TranslateStaticLoader(http, './assets/i18n', '.json');
}

@NgModule({
    imports: [
        BrowserModule,
        HttpModule,
        TranslateModule.forRoot({
            provide: TranslateLoader,
            useFactory: (createTranslateLoader),
            deps: [Http]
        })
    ],
    bootstrap: [AppComponent]
})
export class AppModule { }
0reactions
TeodorKolevcommented, Jan 20, 2017

Sorry I have missed { }

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error loading JSON data in python - Stack Overflow
The call to JSON is fine. You can read more about opening JSONs with python. If you replace your JSON with one of...
Read more >
Python JSONDecodeError Explanation and Solution | CK
The Python JSONDecodeError indicates there is an issue with how a JSON object is formatted. To fix this error, you should read the...
Read more >
json — JSON encoder and decoder — Python 3.11.1 ...
json exposes an API familiar to users of the standard library marshal and pickle modules. Encoding basic Python object hierarchies: >>> >>> import...
Read more >
Loading JSON file throws error - Progress Community
When loading a json file, an error is seen in the browser's console. Loading a Google maps json file on the page throws...
Read more >
VxRail Configuration Deployment Wizard Error loading JSON ...
Hi All, Every time I re-launch the deployment wizard to continue past an error I get this trying to load the JSON file...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found