【问题标题】:AngularJS Module 'agGrid' is not available! You either misspelled the module name or forgot to load itAngularJS 模块“agGrid”不可用!您要么拼错了模块名称,要么忘记加载它
【发布时间】:2017-06-29 18:26:44
【问题描述】:

这是一个常见问题,谷歌搜索显示了很多它的实例,其中很多都在这个网站上。

答案似乎归结为:

  • 未将模块注入应用程序
  • 用于包含相关的 JS
  • index.html 中包含错误顺序的内容

我正在尝试在 instructions for manual include 之后包含 ag-grid。

在我的index.html 中,我包括

  1. 角度
  2. 农业网格
  3. 我的控制器

我用的是Inspinia模板,相关代码是

(function () {
    angular.module('TapThatDashboard', 
    [
        'ui.router',                    // Routing
        'oc.lazyLoad',                  // ocLazyLoad
        'ui.bootstrap',                 // Ui Bootstrap
        'chart.js',                     // Charting
        'agGrid'
    ])
})();

请注意,其他东西正在工作,例如图表。

当我删除 'agGrid' 行时,我的应用程序运行良好(我还没有在我的 HTML 中添加任何网格)。当我添加它时,我得到了

模块“agGrid”不可用!您要么拼错了模块名称,要么忘记加载它

我的代码太大而无法发布。谁能看到我做错了什么?

【问题讨论】:

    标签: angularjs ag-grid


    【解决方案1】:

    请更新您的代码

    // if you're using ag-Grid-Enterprise, you'll need to provide the License Key before doing anything else
    // not necessary if you're just using ag-Grid
    agGrid.LicenseManager.setLicenseKey("your license key goes here");
    
    // get ag-Grid to create an Angular module and register the ag-Grid directive
    agGrid.initialiseAgGridWithAngular1(angular);
    
    // create your module with ag-Grid as a dependency
    var module = angular.module("example", ["agGrid"]);
    

    参考链接:agGrid

    【讨论】:

    • 天啊!我读到了-但没有看到:-/感谢您成为我的眼睛。现在没有错误。下一步是在我的代码中添加一个网格。
    猜你喜欢
    • 2014-12-06
    • 2017-09-26
    • 2016-07-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-27
    相关资源
    最近更新 更多