如何在 ios safari 上填充 Angular 4 中的 IntersectionObserver?
How do I polyfill the IntersectionObserver in Angular 4 on ios safari?
我很想在移动设备上使用这项技术,但它在 safari 中不受支持 - 因此我需要对其进行 polyfill。
我目前正在 index.html
的头部执行 <script src="assets/polyfills/intersection-observer.js"></script>
,但执行此操作后我的应用程序不会加载。
我正在使用 Angular cli 并尝试了 polyfill 文件但无济于事。谁能成功地让它在 Angular 4 移动设备上运行,可以帮助我吗?
谢谢
因为您正在使用 angular cli,您可以通过 npm npm install intersection-observer
安装它并作为 import 'intersection-observer';
导入到 polyfills.ts - 刚刚在 IE11
中测试
我很想在移动设备上使用这项技术,但它在 safari 中不受支持 - 因此我需要对其进行 polyfill。
我目前正在 index.html
的头部执行 <script src="assets/polyfills/intersection-observer.js"></script>
,但执行此操作后我的应用程序不会加载。
我正在使用 Angular cli 并尝试了 polyfill 文件但无济于事。谁能成功地让它在 Angular 4 移动设备上运行,可以帮助我吗?
谢谢
因为您正在使用 angular cli,您可以通过 npm npm install intersection-observer
安装它并作为 import 'intersection-observer';
导入到 polyfills.ts - 刚刚在 IE11