Angular ngx平移,角度9不在IE中工作

Angular ngx平移,角度9不在IE中工作,angular,internet-explorer,ngx-translate,Angular,Internet Explorer,Ngx Translate,我们的应用程序在IE中不工作,它只显示一个编译错误(SCRIPT1002),当导航到该行时,它显示类TranslateLoader 我已经发现了一个类似的问题,不幸的是,答案不起作用: 任何帮助都会很好。非常感谢 package.json "@angular/core": "~9.1.6", ..... "@ngx-translate/core": "^12.0.0", "@ngx-translate/ht

我们的应用程序在IE中不工作,它只显示一个编译错误(SCRIPT1002),当导航到该行时,它显示类
TranslateLoader

我已经发现了一个类似的问题,不幸的是,答案不起作用:

任何帮助都会很好。非常感谢

package.json

"@angular/core": "~9.1.6",
.....
"@ngx-translate/core": "^12.0.0",
"@ngx-translate/http-loader": "^5.0.0",
"classlist.js": "^1.1.20150312",
"web-animations-js": "^2.3.2",
...
"module": "es2015",
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es5",
"typeRoots": [
  "node_modules/@types"
],
"lib": [
  "es2018",
  "dom"
]
...
  "dependencies": {
    "@angular/animations": "~9.1.0",
    "@angular/common": "~9.1.0",
    "@angular/compiler": "~9.1.0",
    "@angular/core": "~9.1.0",
    "@angular/forms": "~9.1.0",
    "@angular/platform-browser": "~9.1.0",
    "@angular/platform-browser-dynamic": "~9.1.0",
    "@angular/router": "~9.1.0",
    "@ngx-translate/core": "^11.0.1",
    "@ngx-translate/http-loader": "^4.0.0",
    "classlist.js": "^1.1.20150312",
    "rxjs": "~6.5.4",
    "tslib": "^1.10.0",
    "web-animations-js": "^2.3.2",
    "zone.js": "~0.10.2"
  },
...     
{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "module": "esnext",
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es5",
    "lib": [
      "es2018",
      "dom"
    ]
  },
  "angularCompilerOptions": {
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true
  }
}
浏览器列表

> 0.5%
last 2 versions
Firefox ESR
not dead
IE 9-11
tsconfig.json

"@angular/core": "~9.1.6",
.....
"@ngx-translate/core": "^12.0.0",
"@ngx-translate/http-loader": "^5.0.0",
"classlist.js": "^1.1.20150312",
"web-animations-js": "^2.3.2",
...
"module": "es2015",
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es5",
"typeRoots": [
  "node_modules/@types"
],
"lib": [
  "es2018",
  "dom"
]
...
  "dependencies": {
    "@angular/animations": "~9.1.0",
    "@angular/common": "~9.1.0",
    "@angular/compiler": "~9.1.0",
    "@angular/core": "~9.1.0",
    "@angular/forms": "~9.1.0",
    "@angular/platform-browser": "~9.1.0",
    "@angular/platform-browser-dynamic": "~9.1.0",
    "@angular/router": "~9.1.0",
    "@ngx-translate/core": "^11.0.1",
    "@ngx-translate/http-loader": "^4.0.0",
    "classlist.js": "^1.1.20150312",
    "rxjs": "~6.5.4",
    "tslib": "^1.10.0",
    "web-animations-js": "^2.3.2",
    "zone.js": "~0.10.2"
  },
...     
{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "module": "esnext",
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es5",
    "lib": [
      "es2018",
      "dom"
    ]
  },
  "angularCompilerOptions": {
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true
  }
}
polyfills.ts

import 'classlist.js';  // Run `npm install --save classlist.js`.
import 'web-animations-js';  // Run `npm install --save web-animations-js`.
import 'zone.js/dist/zone';  // Included with Angular CLI.
我发现并遵循其中的解决方案,然后它可以在IE 11中很好地工作。我用ngx这样翻译。您可以参考我的文件:

package.json

"@angular/core": "~9.1.6",
.....
"@ngx-translate/core": "^12.0.0",
"@ngx-translate/http-loader": "^5.0.0",
"classlist.js": "^1.1.20150312",
"web-animations-js": "^2.3.2",
...
"module": "es2015",
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es5",
"typeRoots": [
  "node_modules/@types"
],
"lib": [
  "es2018",
  "dom"
]
...
  "dependencies": {
    "@angular/animations": "~9.1.0",
    "@angular/common": "~9.1.0",
    "@angular/compiler": "~9.1.0",
    "@angular/core": "~9.1.0",
    "@angular/forms": "~9.1.0",
    "@angular/platform-browser": "~9.1.0",
    "@angular/platform-browser-dynamic": "~9.1.0",
    "@angular/router": "~9.1.0",
    "@ngx-translate/core": "^11.0.1",
    "@ngx-translate/http-loader": "^4.0.0",
    "classlist.js": "^1.1.20150312",
    "rxjs": "~6.5.4",
    "tslib": "^1.10.0",
    "web-animations-js": "^2.3.2",
    "zone.js": "~0.10.2"
  },
...     
{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "module": "esnext",
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es5",
    "lib": [
      "es2018",
      "dom"
    ]
  },
  "angularCompilerOptions": {
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true
  }
}
tsconfig.json

"@angular/core": "~9.1.6",
.....
"@ngx-translate/core": "^12.0.0",
"@ngx-translate/http-loader": "^5.0.0",
"classlist.js": "^1.1.20150312",
"web-animations-js": "^2.3.2",
...
"module": "es2015",
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es5",
"typeRoots": [
  "node_modules/@types"
],
"lib": [
  "es2018",
  "dom"
]
...
  "dependencies": {
    "@angular/animations": "~9.1.0",
    "@angular/common": "~9.1.0",
    "@angular/compiler": "~9.1.0",
    "@angular/core": "~9.1.0",
    "@angular/forms": "~9.1.0",
    "@angular/platform-browser": "~9.1.0",
    "@angular/platform-browser-dynamic": "~9.1.0",
    "@angular/router": "~9.1.0",
    "@ngx-translate/core": "^11.0.1",
    "@ngx-translate/http-loader": "^4.0.0",
    "classlist.js": "^1.1.20150312",
    "rxjs": "~6.5.4",
    "tslib": "^1.10.0",
    "web-animations-js": "^2.3.2",
    "zone.js": "~0.10.2"
  },
...     
{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "module": "esnext",
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es5",
    "lib": [
      "es2018",
      "dom"
    ]
  },
  "angularCompilerOptions": {
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true
  }
}
IE 11中的结果如下:


谢谢,使用11.0.1版的ngx translate,这很有用!