It seems that the actual error is that the .assign method is not implemented in IE11
@samuel-liew can you please review my question and close it. I feel it does not need any new answers.
– Tjaart van der Walt
May 7, 2018 at 14:29
If you are using @angular/cli and intend to support IE9-11 you can edit the src/polyfills.ts file to enable appropriate polyfills. The required polyfills are already in the file so all you need to do is un-comment them.
By default @angular/cli projects target “evergreen” browsers out of the box which means that IE isn’t immediately supported, but you can add support by importing polyfills for the features you need.
@spoida – how does the polyfills file work? If I uncomment it, is it only going to use the polyfill for the old browsers and resort to using the standard way for ever green browsers? Or will it only use polyfill from now on?
– Diskdrive
Jun 1, 2017 at 12:35
@Diskdrive – typically the polyfill will inspect the browser’s implementation and only add things if the implementation is incomplete. So, yes, if the browser already supports the feature then the polyfill’s implementation won’t be used.
– spoida
Jun 2, 2017 at 8:54
@spoida – thanks but if that is the case and it’s only used when the browser needs it, why is it commented out by default?
– Diskdrive
Jun 2, 2017 at 9:12
@Diskdrive – I suspect that is because there is a small overhead associated with checking if a feature is supported rather than just assuming it’s implemented and calling it directly. So if you’re not targeting IE, by default Angular won’t introduce that small overhead. If you do need to target IE, then other supported browsers will take a slight performance hit but they will still use their native implementations rather than a JavaScript equivalent. IE, on the other hand, will rely on the JavaScript implementation which could be orders of magnitude slower than native implementations.
– spoida
Jun 2, 2017 at 13:51
Stanislav Berkov
Angular has dependency on core-js. Thereby you can use Object.assign polyfills from it:
import "core-js/client/shim"; // or load it before other angular2 & zone.js stuff
import "zone.js";
import "reflect-metadata";
mate, your answer would get more votes if you mentioned that these lines are in src/polyfills.ts. Thank you anyway, helped me to solve the problem!
– VeganHunter
Apr 10, 2017 at 7:37
VS2017 doesn’t have a polyfills file, so I added the code in the boot app ts file…worked well…thanks
– davaus
Jul 25, 2017 at 1:05
In the new VS2017 SPA templates just need to add the core-js line to boot.server.ts and boot.browser.ts
– Vishal
Mar 8, 2018 at 16:20
It’s really annoying that the Angular Materials tutorial doesn’t mention this problem. Anyone using IE11 and following their tutorial will hit this issue.
The solution, as others have mentioned, is to simply uncomment those lines in your project’s polyfills.ts file.
But really, this should’ve been mentioned in their tutorial.
I’m spending far too many hours Googling to find solutions to these Angular problems…
I totally agree with you. I am new to angular 4, although i was working with angularjs before, still couldn’t find the solution and couldn’t guess what has gone wrong here. But thanks this worked better for me than the other one.
@samuel-liew can you please review my question and close it. I feel it does not need any new answers.
May 7, 2018 at 14:29