安装angular-slickgrid后出现“jQuery not defined”错误

y1aodyip  于 12个月前  发布在  jQuery
关注(0)|答案(1)|浏览(134)

首先让我明确一件事,我已经通过https://github.com/ghiscoding/angular-slickgrid/wiki/HOWTO---Step-by-Step和遵循每一步,这是强制性的要求。无论如何,让我告诉你什么步骤,我遵循
1.安装Angular slickGrid npm i angular-slickgrid
1.在angular.json中添加了所需的css和js

"node_modules/bootstrap/dist/css/bootstrap.css",
    "node_modules/font-awesome/css/font-awesome.css",
    "node_modules/flatpickr/dist/flatpickr.css",
    "node_modules/angular-slickgrid/lib/multiple-select/multiple-select.css",
    "styles.css"
],
"scripts": [
    "node_modules/jquery/dist/jquery.js",
    "node_modules/jquery-ui-dist/jquery-ui.min.js",
    "node_modules/slickgrid/lib/jquery.event.drag-2.3.0.js",
    "node_modules/bootstrap/dist/js/bootstrap.js",
    "node_modules/angular-slickgrid/lib/multiple-select/multiple-select.js"
],

字符串
1.在app.module.ts中正确导入AngularSlickgridModule
imports: [ AngularSlickgridModule.forRoot() ]
1.我已经安装了所需的包为角slickgrid
package.json

"@angular/animations": "^9.1.9",
  "@angular/cdk": "^9.2.4",
  "@angular/compiler": "^9.1.9",
  "@angular/material": "^9.2.4",
  "@angular/platform-browser": "^9.1.9",
  "@angular/platform-browser-dynamic": "^9.1.9",
  "@angular/router": "^9.1.9",
  "bootstrap": "^4.4.1",
  "font-awesome": "^4.7.0",
  "@types/jquery": "^3.3.38",
  "jquery": "^3.3.1",
  "@ngx-translate/core": "^12.1.2",
  "@ng-bootstrap/ng-bootstrap": "^6.1.0",


的数据

fgw7neuy

fgw7neuy1#

我在Angular 12上使用[[email protected]](https://stackoverflow.com/cdn-cgi/l/email-protection)时遇到了同样的问题,我找到了这个解决方案。在app.component.ts中添加:

import * as $ from 'jquery';
window["$"] = $;
window["jQuery"] = $;

字符串

相关问题