Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I polyfill the IntersectionObserver in Angular 4 on ios safari?

I'm keen to use this technology on a mobile device but it's not supported in safari - hence why I need to polyfill it.

I'm currently doing <script src="assets/polyfills/intersection-observer.js"></script> in the head of the index.html but my app won't load after doing this.

I'm using Angular cli and have tried the polyfill file to no avail. Can someone who has successfully managed to get it working in Angular 4 on mobile help me out?

Thanks

like image 289
Joe Keene Avatar asked Dec 04 '22 20:12

Joe Keene


1 Answers

as you are using angular cli you can install this via npm npm install intersection-observer and import into polyfills.ts as import 'intersection-observer'; - just tested in IE11

like image 127
godblessstrawberry Avatar answered Apr 09 '23 06:04

godblessstrawberry