任何人都可以请指导如何使用Smooth Scroll Polyfill与Angular 2 CLI。使用Smooth Scroll Polyfill与Angular 2 CLI
我尝试添加下面polyfills.ts但它抛出错误的工作需要
require('smoothscroll-polyfill').polyfill();
我再尝试添加
import 'smoothscroll-polyfill';
虽然没有构建过程中引发任何错误,但当我在浏览器中运行该项目时,在控制台上显示以下错误:
ERROR TypeError: Failed to execute 'scroll' on 'Window': No function was found that matched the signature provided.
它被认为是更好的做法,把这个'scripts'在'.angular-cli.json',从'node_modules'加载它。 – 2017-04-03 02:53:06
感谢您的回复,但由于在角度cli项目中有一个名为polyfills.ts的文件,我相信应该在此文件中添加polyfills。我遇到了这个http://stackoverflow.com/a/42982811/2755616但它似乎没有工作。 –