Angular 2 和 jQuery - 如何测试? [英] Angular 2 and jQuery - how to test?

查看:21
本文介绍了Angular 2 和 jQuery - 如何测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Angular 2 项目中使用 Angular-CLI(webpack 版本),我还需要使用 jQuery(很遗憾.就我而言,它是 Semantic-UI 的依赖项,我用它来处理菜单下拉菜单).

I am using Angular-CLI (webpack version) for my Angular 2 project and I also need to use jQuery (sadly. In my case, it's a dependency of Semantic-UI and I am using it for handling menu dropdowns).

我使用它的方式:

npm install jquery --save

然后在scripts数组中列出angular-cli.json文件:

Then listing in it angular-cli.json file in the scripts array:

scripts": [
  "../node_modules/jquery/dist/jquery.min.js"
]

所以它被包含在包文件中,这个文件被自动用于根 html 文件:

So it gets included into bundle file and this file is automatically used to root html file:

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