npm install --save jquery

npm install @types/jquery --save

 

在对应的组件中引入

import * as $ from "jquery";

 在整个项目中一次声明,不用重复引入的方式:

.angular-cli.json文件中添加

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "project": {
    "name": "map"
  },
  "apps": [
    {
     ...
      "styles": [
       ...
      ],
      "scripts": [
        "../node_modules/jquery/dist/jquery.js",
       ...
      ],
      ...
    }
  ],
}

 

相关文章:

  • 2022-12-23
  • 2021-09-16
  • 2022-03-07
  • 2022-12-23
  • 2022-12-23
  • 2021-05-28
  • 2021-08-07
  • 2022-12-23
猜你喜欢
  • 2021-10-25
  • 2022-12-23
  • 2021-07-20
  • 2022-12-23
  • 2021-12-31
  • 2021-10-15
  • 2021-09-02
相关资源
相似解决方案