2

I added ng2-translate to my angular-cli project. It's work well in localhost but when I try to run it from ng build prod, I got 404 not found:

http://MySite/assets/i18n/en.json Failed to load resource: the server responded with a status of 404 (Not Found)

The file exist in this path, but not found by the browser.

I added this providerto app.module.ts:

providers: [ { provide: TranslateLoader, useFactory: (http: Http) => new TranslateStaticLoader(http, 'assets/i18n', '.json'), deps: [Http] }]

Maybe I should have to add some declaration to angular-cli.json? but what?

user3292624
  • 180
  • 2
  • 10

1 Answers1

3

OK I found the solution. I need to add an .json file to IIS configuratin:

<staticContent>
    <mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>

Now the translation work well.

user3292624
  • 180
  • 2
  • 10