错误TypeError:$(...)。DataTable不是在angular 4中使用的函数 [英] ERROR TypeError: $(...).DataTable is not a function while using in angular 4

查看:80
本文介绍了错误TypeError:$(...)。DataTable不是在angular 4中使用的函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到错误TypeError:$(...)。DataTable在angular 4中使用时不是一个函数。

I'm getting ERROR TypeError: $(...).DataTable is not a function while using in angular 4.

解决此问题的任何建议。

Any suggestions for resolving this issue.

推荐答案

如果要将jQuery作为本地库导入,则在* component.ts文件中,例如:

If you are importing jQuery as a local lib, in your *component.ts file, like:

import * as jquery from 'jquery'

删除该行并将其视为全局库:

remove that line and treat it as a global library:

declare var jquery: any;

declare var $: any;

或仅将这两行之一添加到src / typings.d.ts

or just add one of that two lines to src/typings.d.ts

这篇关于错误TypeError:$(...)。DataTable不是在angular 4中使用的函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆