【问题标题】:Angular Form not working in Internet Explorer 11Angular 表单在 Internet Explorer 11 中不起作用
【发布时间】:2020-03-24 05:03:01
【问题描述】:

我开发了一个 Angular 6 项目。在 Chrome、Mozilla 和 Apple 浏览器中一切正常,但在 Internet Explorer 11 中无法正常工作。我无法保存单击按钮时的数据。

在控制台(网络)中,单击按钮时,它没有调用 API。

我需要在 IE11 的角度 TS 文件中进行任何特殊导入吗?

【问题讨论】:

标签: angular internet-explorer-11


【解决方案1】:

转到您的polyfills.ts 文件并找到在/** IE9, IE10 and IE11 requires all of the following polyfills. */ 部分下注释掉的导入语句:

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

取消注释上述导入以使您的应用程序与这些 IE 浏览器一起工作,但不要忘记运行以下命令。

npm install --save classlist.js

您可能还需要取消注释以下导入:

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

别忘了运行以下命令:

npm install --save web-animations-js

编辑

browserslist 文件中,您可以将not IE 9-11 替换为IE 9-11

另外,在tsconfig.json 文件中,您可以将"target": "es2015"(或其他)替换为"target": "es5"

【讨论】:

  • 感谢您的回答。但它不会工作
  • 好的,你能检查我答案的编辑部分吗? :)
【解决方案2】:

您的问题没有包含足够的信息来给出实际答案。不过IE11+form过去给我带来了一些麻烦。

就我而言,我必须将type='submit' 添加到提交按钮,并将type='button' 添加到所有其他按钮。

【讨论】:

    【解决方案3】:

    在 Angular 网站上,很明显不支持 Internet Explorer 11,您必须使用此 github 页面的自述文件中编写的以下步骤来配置您的 Angular 项目。

    https://github.com/browserslist/browserslist

    【讨论】:

      猜你喜欢
      • 2016-10-20
      • 2019-08-12
      • 2014-08-22
      • 1970-01-01
      • 1970-01-01
      • 2015-10-19
      • 1970-01-01
      • 1970-01-01
      • 2015-03-22
      相关资源
      最近更新 更多