2017-02-11 49 views
1

这是常见问题,谷歌搜索显示了它的很多实例,其中很多都在本站点上。AngularJS模块'agGrid'不可用!您拼错模块名称或忘记加载它

的答案似乎归结为:

  • 模块没有注入到应用
  • 用于获取包括有关JS
  • 包括顺序错误的东西在index.html

我正试图包括Ag-Grid,继instructions for manual include

在我index.html,我包括

  1. AG-电网
  2. 我控制器

我现在用的是Inspinia模板,以及相关的代码是

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

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

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

模块'agGrid'不可用!您拼写模块名称或忘记加载它

我的代码太大而无法发布。任何人都可以看到我在做错吗?

回答

2

请更新您的代码像

// 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

+0

D'哦!我读到了 - 但没有看到: - /谢谢你成为我的眼睛。现在没有错误。下一步是在我的代码中添加一个网格。 – Mawg

相关问题