AngularJS Material is a cutting edge framework which uses advanced CSS features. Internet Explorer is known to have performance issues with some of these features. Some of the notable issues are related to layout calculations, animations, and border rendering. In this document, we will provide optimizations which can improve performance in Internet Explorer.
This document should be consulted after the AngularJS code in an application is optimized:
AngularJS Material theming works by injecting inline styles into the <head>
. The benefit
is that the theme can be switched or modified at runtime. Unfortunately these inline styles can
present a performance burden for Internet Explorer. When switching or modifying themes at runtime
is not a requirement, the theming CSS can be exported to an external file which can be loaded statically.
The following steps should be performed:
index.html
.One of the greatest issues with Internet Explorer, is the slow layout calculation. The more elements are in the dom, the slower the calculations are. This is especially important with ng-repeat. Let's take the following Example:
{{::person.name }}
In this example, a list of people is shown. When a person is clicked, a md-dialog
is opened.
The opening of the dialog inserts a md-backdrop and a layout calculation of the whole DOM is triggered.
The bigger the list gets, the opening of the dialog is slowed down.
The best solution is to keep the DOM small. The list elements which should be in the DOM are just the elements which fit in the viewport at any one time. This can be achieved by using Virtual Repeat.
The solution is easy and elegant:
{{ person.name }}
The virtual repeat directive only adds, to the dom, the elements visible in the viewport. When the view is scrolled the existing elements are reused. Using this solution, the virtual repeat directive supports real-time scrolling through millions of records (assuming all in-memory).
Caveat: Virtual Repeat requires the height of all list items to be equal and static.
This restriction is key to the performance that it provides.
The Tabs directive is capable of some very nice animations. This comes at a cost of layout calculations which increase in cost as DOM items are added to the content of the tabs. Internet Explorer's layout calculations are slower than other browsers when Flexbox is involved. This means that tabs that work fine on Chrome and Firefox, may lag for your IE users. The primary alternative to the Tabs directive is the NavBar directive.
Another alternative is to:
The Material Adaptive Shrine app has an example of this.
md-on-select
or data binding to update the productGrid content.AngularJS Material comes with all of the bells and whistles turned on by default. These can be switched off selectively for Internet Explorer.
Disabling support for touch gestures across the app can improve performance in IE.
The material ink ripple animation effects can be turned off using the $mdInkRippleProvider
.