【问题标题】:AngularJS: Dynamic Injection of third party modulesAngularJS:第三方模块的动态注入
【发布时间】:2014-03-28 16:29:01
【问题描述】:

在角引导完成后,有什么方法可以动态注入第三方模块?我正在尝试使用 ngGrid 和 ngTable,但它不起作用。

例如,我定义了我的 ngApp 模块: angular.module("app", ["ngRoute"]); // 我在 html 中定义的“应用程序”,例如: ....

现在我加载 controller.js、ng-grid.debug.js 文件和 grid.html 文件:

grid.html 包含:

controller.js 包含用于表数据的 $scope 变量“gridOptions”。

所以我在运行中包含了 ng-grid.debug.js,但是如何在运行中将“ngGrid”模块包含到主应用程序模块中。

但事情不工作。有人可以建议吗?

【问题讨论】:

    标签: angularjs dynamic dependencies code-injection ng-grid


    【解决方案1】:

    我也添加了 plunker.. 请检查: http://plnkr.co/edit/fFDQwX

    所以如果我在 app.js 文件中添加“ngGrid”,在 app 模块中,它可以工作文件,但如果我在运行中从 demand.js 做同样的事情,它就不会工作。

    【讨论】:

      猜你喜欢
      • 2023-03-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-28
      相关资源
      最近更新 更多