我想将这两个angularJS依赖注入集成到一个项目中

时间:2018-06-22 10:03:00

标签: angularjs electron videogular

我正在一个项目中,我需要使用electroJS平台在angular-filemanager上集成一个名为“ videogular”的视频插件。

这是videogular

的链接

这是我的项目Dependency Injection:

(function (angular) {
        'use strict';
        var FileManagerApp = angular.module('FileManagerApp');

        FileManagerApp.controller('FileManagerCtrl',
            ['$scope', 
            '$rootScope', 
            '$window', 
            '$translate', 
            'fileManagerConfig', 
            'item', 'fileNavigator', 
            'apiMiddleware',
        function ($scope,$rootScope, $window, $translate, fileManagerConfig, Item, FileNavigator, ApiMiddleware)

这是视频依赖注入:

angular.module('myApp',
        [
            "ngSanitize",
            "com.2fdevs.videogular",
            "com.2fdevs.videogular.plugins.controls",
            "com.2fdevs.videogular.plugins.overlayplay",
            "com.2fdevs.videogular.plugins.poster"])
    .controller('HomeCtrl',
        ["$sce", function ($sce) {

        }]
    );

当我尝试以这种方式集成它时:

(function (angular) {
    'use strict';
    var FileManagerApp = angular.module('FileManagerApp',
    [
        "ngSanitize",
        "com.2fdevs.videogular",
        "com.2fdevs.videogular.plugins.controls",
        "com.2fdevs.videogular.plugins.overlayplay",
        "com.2fdevs.videogular.plugins.poster"]);

    FileManagerApp.controller('FileManagerCtrl',
     [
         '$scope', 
         '$sce', 
         '$rootScope', 
         '$window', 
         '$translate', 
         'fileManagerConfig', 
         'item', 
         'fileNavigator', 
         'apiMiddleware',

                function (
                        $scope ,
                        $sce,
                        $rootScope, 
                        $window, 
                        $translate, 
                        fileManagerConfig, 
                        Item, 
                        FileNavigator, 
                        ApiMiddleware) {

I get this error

请帮助我解决这个问题。

1 个答案:

答案 0 :(得分:1)

您需要在FileManagerApp模块中注入myApp才能使用它。

angular.module('myApp',
        [
            "ngSanitize",
            'FileManagerApp', // <--- here
            "com.2fdevs.videogular",
            "com.2fdevs.videogular.plugins.controls",
            "com.2fdevs.videogular.plugins.overlayplay",
            "com.2fdevs.videogular.plugins.poster"])

,或者反之亦然:

var FileManagerApp = angular.module('FileManagerApp',
[
    "ngSanitize",
    "myApp", // < -- here
    "com.2fdevs.videogular",
    "com.2fdevs.videogular.plugins.controls",
    "com.2fdevs.videogular.plugins.overlayplay",
    "com.2fdevs.videogular.plugins.poster"]);

注意

确保您没有注射

    "com.2fdevs.videogular",
    "com.2fdevs.videogular.plugins.controls",
    "com.2fdevs.videogular.plugins.overlayplay",
    "com.2fdevs.videogular.plugins.poster"

同时插入两个模块。