Angular2 + ag-Grid无法加载ag-Grid -ng2/main.js (404 Not Found)
Angular2 + ag-Grid cannot load ag-grid-ng2/main.js (404 Not Found)
我正在尝试将ag-Grid与Angular2集成,但我被困在以下错误:
zone.js:101 GET http://localhost:4200/node_modules/ag-grid-ng2/main.js404(未找到)
我正在导入第三方组件使用:
import {AgGridNg2} from 'ag-grid-ng2/main';
...
directives: [AgGridNg2]
这是我的系统配置。ts 文件:
"use strict";
// SystemJS configuration file, see links for more information
// https://github.com/systemjs/systemjs
// https://github.com/systemjs/systemjs/blob/master/docs/config-api.md
/***********************************************************************************************
* User Configuration.
**********************************************************************************************/
/** Map relative paths to URLs. */
const map: any = {
// ag libraries
'ag-grid-ng2': 'node_modules/ag-grid-ng2',
'ag-grid': 'node_modules/ag-grid',
'ag-grid-enterprise' : 'node_modules/ag-grid-enterprise'
};
/** User packages configuration. */
const packages: any = {
'ag-grid-ng2': {
defaultExtension: "js"
},
'ag-grid': {
defaultExtension: "js"
},
'ag-grid-enterprise': {
defaultExtension: "js"
}
};
////////////////////////////////////////////////////////////////////////////////////////////////
/***********************************************************************************************
* Everything underneath this line is managed by the CLI.
**********************************************************************************************/
const barrels: string[] = [
// Angular specific barrels.
'@angular/core',
'@angular/common',
'@angular/compiler',
'@angular/forms',
'@angular/http',
'@angular/router',
'@angular/platform-browser',
'@angular/platform-browser-dynamic',
// Thirdparty barrels.
'rxjs',
// App specific barrels.
'app',
'app/shared',
'app/full-width-renderer',
/** @cli-barrel */
];
const cliSystemConfigPackages: any = {};
barrels.forEach((barrelName: string) => {
cliSystemConfigPackages[barrelName] = { main: 'index' };
});
/** Type declaration for ambient System. */
declare var System: any;
// Apply the CLI SystemJS configuration.
System.config({
map: {
'@angular': 'vendor/@angular',
'rxjs': 'vendor/rxjs',
'main': 'main.js'
},
packages: cliSystemConfigPackages
});
// Apply the user's configuration.
System.config({ map, packages });
我可以在/node_modules/ag-grid-ng2文件夹下看到依赖项:
感谢您的帮助
我还没有使用企业网格,但是要在Angular 2中使用ag-grid,你需要在System.config的map部分中包含它:
'ag-grid': 'node_modules/ag-grid',
'ag-grid-ng2': 'node_modules/ag-grid-ng2'
还要确保在node_modules包中有这些模块,否则确保在包中包含这些描述。
相关文章:
- 如何仅在ui-grid.js中显示特定列
- 如何在 ag-grid 中设置默认的最小和最大列宽
- 如何在 ag-grid 中增加列标题的高度
- 覆盖javascript函数ag-grid
- AG-Grid 不会填充在函数中
- 如何通过 ag-grid 内的角度材料菜单获取行数据
- AG-GRID中的细胞合并
- 如何在 ag-grid 中从 http 调用加载动态列和行(列和记录都应该是动态的)
- 来自服务器的行未显示在 Ag-grid 中
- AG-Grid 将列标题设置为复选框,然后执行全选或取消全选列,而不是仅组
- AngularJS + ag-grid:具有虚拟分页/无限滚动的粘性/记忆选择
- ag-grid + templateUrl在IE9中崩溃
- 如何使用ag-grid内置列过滤过滤组合值
- Ag-grid -如何显示显示/隐藏列的selectAll选项企业设置过滤器
- 在ag-grid(纯JS)中处理长时间排序
- AngularJS ag-grid在调整大小后获取列的宽度
- Angular2 + ag-Grid无法加载ag-Grid -ng2/main.js (404 Not Found)
- Ag-grid企业过滤器不工作
- 是否有可能通过添加额外的标题选项来显示在ag-grid中添加新列的引导模型?
- 如果rowData为null,如何隐藏ag-grid