【问题标题】:AngularJS Dependency injection failure - Drag&DropAngularJS 依赖注入失败 - 拖放
【发布时间】:2018-01-30 17:38:53
【问题描述】:

我正在尝试实现拖放系统。 我发现了一个惊人的: http://marceljuenemann.github.io/angular-drag-and-drop-lists/demo/#/nested GitHub: https://github.com/marceljuenemann/angular-drag-and-drop-lists/issues

现在,它说将“dndLists”加载到我的依赖项中 - 所以我的应用看起来像这样:

var app = angular.module('clarus_app', ['ngRoute'], ['dndLists'] );

然后它崩溃了。

angular.js:116 Uncaught Error: [$injector:modulerr] 无法实例化模块 clarus_app 由于: 错误:[ng:areq] 参数 'fn' 不是函数,得到字符串

不知道我做错了什么。 页面使用的控制器如下所示: app.controller("logCtrl", ['$scope','$location','$http', function($scope, $location, $http){

有什么帮助吗?有什么想法吗?

提前致谢。

【问题讨论】:

    标签: javascript jquery angularjs drag-and-drop


    【解决方案1】:

    对于模块依赖,你有 2 个不同的数组参数,并且只想要一个包含所有依赖的数组

    改变

    var app = angular.module('clarus_app', ['ngRoute'], ['dndLists'] );
    

    var app = angular.module('clarus_app', ['ngRoute','dndLists'] );
                                          // ^^ single array of dependent module names
    

    【讨论】:

      猜你喜欢
      • 2016-04-25
      • 2017-09-16
      • 1970-01-01
      • 2012-08-13
      • 2017-09-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多