Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Performance angular2在IE和核心js的使用方面进展缓慢_Performance_Angular_Internet Explorer - Fatal编程技术网

Performance angular2在IE和核心js的使用方面进展缓慢

Performance angular2在IE和核心js的使用方面进展缓慢,performance,angular,internet-explorer,Performance,Angular,Internet Explorer,我发现,与其他浏览器相比,我创建的angular2应用程序在IE11中要慢得多(大约5倍)。在IE11中,从网格中的数据呈现开始,下拉、分页都很慢,而同样的速度非常快,在其他浏览器中也能正常工作。当我在谷歌上搜索时,我发现使用core js和enableProdMode()可能会提高IE的性能。我已经启用了enableProdMode(),但我不清楚如何将core js与angular2应用程序连接起来。我已经将CoreJS作为依赖项包含并安装了它。那么下一步是什么呢?将以下库作为polyfil

我发现,与其他浏览器相比,我创建的angular2应用程序在IE11中要慢得多(大约5倍)。在IE11中,从网格中的数据呈现开始,下拉、分页都很慢,而同样的速度非常快,在其他浏览器中也能正常工作。当我在谷歌上搜索时,我发现使用core js和enableProdMode()可能会提高IE的性能。我已经启用了enableProdMode(),但我不清楚如何将core js与angular2应用程序连接起来。我已经将CoreJS作为依赖项包含并安装了它。那么下一步是什么呢?

将以下库作为polyfills.ts的一部分使我的应用程序速度更快,但它的性能从未与Chrome相匹配

import 'core-js/client/core';
import 'zone.js/dist/zone';
import 'rxjs/bundles/Rx';
import '@angular/core/bundles/core.umd';
import '@angular/common/bundles/common.umd';
import '@angular/compiler/bundles/compiler.umd';
import '@angular/platform-browser/bundles/platform-browser.umd';
import '@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd';`

注意,添加这些文件会大幅增加包的大小。

请使用angularcli commondline创建角度项目

使用ng build--prod编译您的angular项目


这将与Chrome相同。我已经在我的应用程序中像charm一样进行了测试和工作

angular 6中的问题是对函数进行了输入绑定:

<app-my-component [model]="getMyModel()"></app-my-component>

我改为变量

<app-my-component [model]="valueOfGetMyModel"></app-my-component>

这个简单的更改修复了我的一个主要性能问题。此外,该函数在IE中使用了一个polyfilled函数,而其他浏览器的本机实现没有显示任何值得注意的问题


最后,我还将changeDetection策略更改为onPush,因为该组件在页面中有15个实例。

我将
/node\u modules/core js/client/shim.min.js
作为index.html文件的一部分。还是太慢了。你能再检查一下吗not@PankajParkar-在将问题发布到stackoverflow之前,我确实尝试过此方法。但不幸的是,它对我不起作用。您是否尝试过
/node\u modules/core js/client/core.min.js
?您能告诉我,我可以在哪个组件中添加这些导入