在Angular 2/4中使用jQuery的最简便方法 [英] Easiest and Shortest way possible to use jQuery in Angular 2/4

查看:79
本文介绍了在Angular 2/4中使用jQuery的最简便方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Angular中使用jQuery?

如何将jQuery导入Angular2 Typescrypt项目?

我不知道这是否安全,但一定会帮助您.相当

I don't know if this is safe but will sure help you. quite

推荐答案

我们有两个选择,用于在angular2/4中使用jQuery.

We have two option, for using jQuery in angular2/4.

第1步:

将jQuery库下载到您的项目文件夹中,并使用脚本模块在angular/cli json中指定路径.

Download jQuery library into your project folder and specify the path in angular/cli json withing the script module.

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

第2步:或者我们可以使用在线CDN或index.html

Step 2: or we can use the online CDN or the local path of the jQuery library in index.html

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="https://fonts.googleapis.com/css?family=Dosis:300,400,500,600,700" rel="stylesheet">

    <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
//here you can give link to it
  </head>

这篇关于在Angular 2/4中使用jQuery的最简便方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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