我在angular1项目中尝试使用ag-grid

时间:2021-12-09 19:39:55

I'm in Jhipster starter with angular 1 project. I have some problems withe ag-grid component.

我在Jhipster starter与角1项目。我对aggrid组件有一些问题。

first one: i use bower for all my component and wiredep include my ag-grid file before the angular.js file. I think i solve this by using overrides, but i'm not sure of me I set this on overrides in bower.json.

第一个:我对所有组件都使用bower, wiredep包括我的ag-grid文件在角度之前。js文件。我想我是通过使用overrides来解决这个问题的,但是我不确定我把它设置为bower.json中的overrides。

"ag-grid": {
  "dependencies": {
    "angular": "*"
  }
}

ag-grid is well after angular.js now but i still have an other problem.

ag-grid非常适合角化。现在我还有一个问题。

in my console i have this "Uncaught ReferenceError: require is not defined" cause by the bower_components/ag-grid/main.js code here :

在我的控制台中,我有这个“未捕获的ReferenceError: require没有定义”,因为bower_components/ag-grid/main。js代码:

var populateClientExports = require('./dist/lib/clientExports').populateClientExports;

populateClientExports(exports);

populateClientExports(出口);

i don't know what happen, if it's my override not working or something else.

我不知道发生了什么,如果是我的重写不工作或别的什么。

Thanks you for your help.

谢谢你的帮助。

1 个解决方案

#1


2  

First, the override should be correct. you can simply check the override, if you look into the index.html and check the order of the included scripts.

首先,重写应该是正确的。如果您查看索引,您可以简单地检查覆盖。并检查所包含脚本的顺序。

Secondly, ag grid uses commonjs to load the files. But Jhipster does not use common js. so, you have to use the non-commonjs version of ag grid. If my quick view into the docs are right, you must use another version of ag grid. For this, you have to override the main file in your bower.json, so wiredep will pick up this one. Therefore, this

其次,ag grid使用commonjs加载文件。但是Jhipster并不使用普通的js。因此,您必须使用ag网格的非commonjs版本。如果我对文档的快速查看是正确的,您必须使用另一个版本的ag网格。为此,您必须重写位于您的凉亭中的主文件。wiredep会选择这个。因此,该

"ag-grid": {
   "dependencies": {
    "angular": "*"
  },
  "main": [
   "dist/ag-grid.js"
  ]
}

should load the non-commonjs version

应该加载非commonjs版本吗

#1


2  

First, the override should be correct. you can simply check the override, if you look into the index.html and check the order of the included scripts.

首先,重写应该是正确的。如果您查看索引,您可以简单地检查覆盖。并检查所包含脚本的顺序。

Secondly, ag grid uses commonjs to load the files. But Jhipster does not use common js. so, you have to use the non-commonjs version of ag grid. If my quick view into the docs are right, you must use another version of ag grid. For this, you have to override the main file in your bower.json, so wiredep will pick up this one. Therefore, this

其次,ag grid使用commonjs加载文件。但是Jhipster并不使用普通的js。因此,您必须使用ag网格的非commonjs版本。如果我对文档的快速查看是正确的,您必须使用另一个版本的ag网格。为此,您必须重写位于您的凉亭中的主文件。wiredep会选择这个。因此,该

"ag-grid": {
   "dependencies": {
    "angular": "*"
  },
  "main": [
   "dist/ag-grid.js"
  ]
}

should load the non-commonjs version

应该加载非commonjs版本吗