简体   繁体   English

Angular 8 + IE 11 Angular 应用程序不适用于 IE 11

[英]Angular 8 + IE 11 angular application not working on IE 11

i am working on angular 8. my application is ready for production but it is not working on IE11.我正在处理 angular 8。我的应用程序已准备好用于生产,但它不适用于 IE11。 All other browsers it works fine.所有其他浏览器都可以正常工作。 on IE 11 it shoes an empty page with some error.在 IE 11 上,它显示一个带有一些错误的空白页面。 i have gone through some websites did the following.我浏览了一些网站做了以下事情。 still not working :(. thanks in advance for your help仍然无法正常工作:(。提前感谢您的帮助

Step 1 :第1步 :

...
"target": "es5"

step 2: not IE 9-10 IE 11第 2 步:不是 IE 9-10 IE 11

step 3 changes polyfil.ts第 3 步更改 polyfil.ts

"still nothing works" “仍然没有任何效果”

What I will suggest is you start debugging with IE.我的建议是您开始使用 IE 进行调试。 Go to individual files where its throwing the errors.转到抛出错误的单个文件。 Mostly it throws error for the use of大多数情况下它会引发错误以使用

=> =>

many others can be.许多其他人可以。 So you need to transpile those codes to more basic code.因此,您需要将这些代码转换为更基本的代码。 My goto site for transpiling codes is: Babel .我转译代码的转到站点是: Babel Just you need to change those codes to transpiled codes.只是您需要将这些代码更改为转换后的代码。

Hope it helps.希望能帮助到你。

You need to follow the following steps to make Angular 8 app run in IE 11:您需要按照以下步骤使 Angular 8 应用程序在 IE 11 中运行:

  1. Create a new tsconfig tsconfig-es5.app.json next to tsconfig.app.json with the below contents:创建一个新的tsconfig tsconfig-es5.app.json旁边tsconfig.app.json与下面的内容:

     { "extends": "./tsconfig.app.json", "compilerOptions": { "target": "es5" } }
  2. In angular.json add two new configuration section under the build and serve target to provide a new tsconfig:angular.json ,在buildserve目标下添加两个新的配置部分,以提供新的 tsconfig:

     "build": { "builder": "@angular-devkit/build-angular:browser", "options": { ... }, "configurations": { "production": { ... }, "es5": { "tsConfig": "./tsconfig-es5.app.json" } } }, "serve": { "builder": "@angular-devkit/build-angular:dev-server", "options": { ... }, "configurations": { "production": { ... }, "es5": { "browserTarget": "yourAppName:build:es5" } } },
  3. Run the serve with this configuration using the below command:使用以下命令使用此配置运行服务:

     ng serve --configuration es5
  • Un-comment some imports in the polyfill.ts file.取消注释 polyfill.ts 文件中的一些导入。
  • Install a couple of npm packages.安装几个 npm 包。
  • Modify the browserslist file ( browserslistrc file with Angular 11 Project ).修改 browserslist 文件(使用 Angular 11 项目的 browserslistrc 文件)。

Un-comment a couple of lines under \\src\\polyfills.ts取消注释 \\src\\polyfills.ts 下的几行

// import 'classlist.js';  // Run `npm install --save classlist.js`.

// import 'web-animations-js';  // Run `npm install --save web-animations-js`.

Install a couple of npm packages.安装几个 npm 包。

npm install --save classlist.js
npm install --save web-animations-js

Modify the browserslist file.修改浏览器列表文件。

Search for the below line.搜索以下行。

not IE 9-11 # For IE 9-11 support, remove 'not'.

Remove not keyword.删除不是关键字。

IE 9-11 # For IE 9-11 support, remove 'not'.

With Angular 11 browserslistrc file使用 Angular 11 browserslistrc 文件

not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.

Remove not keyword.删除不是关键字。

IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM