App Dependency奇怪的行为AngularJS

时间:2015-09-17 14:22:36

标签: angularjs angularjs-module

首先,我对AngularJS非常新,所以它可能是一个新问题。

我在app.js文件中声明了我的应用程序Dependancies:

(function () {
    angular.module('inspinia', [
        'ui.router',                    // Routing
        'oc.lazyLoad',                  // ocLazyLoad
        'ui.bootstrap',                 // Ui Bootstrap
        'pascalprecht.translate',       // Angular Translate
        'ngIdle',                       // Idle timer
        'ngSanitize',                   // ngSanitize
    ])
})();

当我添加以下依赖项时:nestedDataTable到列表的末尾(或开头),如下所示:

(function () {
angular.module('inspinia', [
    'ui.router',                    // Routing
    'oc.lazyLoad',                  // ocLazyLoad
    'ui.bootstrap',                 // Ui Bootstrap
    'pascalprecht.translate',       // Angular Translate
    'ngIdle',                       // Idle timer
    'ngSanitize',                   // ngSanitize
    'nestedDataTable'
])})();

nestedDataTable负责的功能无效。

只有在我添加了一个仅添加上述依赖项的新function()之后,该功能才有效。像这样:

(function () {
angular.module('inspinia', [
    'ui.router',                    // Routing
    'oc.lazyLoad',                  // ocLazyLoad
    'ui.bootstrap',                 // Ui Bootstrap
    'pascalprecht.translate',       // Angular Translate
    'ngIdle',                       // Idle timer
    'ngSanitize'                    // ngSanitize
])
})();
(function () {
    "use strict";
    angular
        .module("inspinia", ["nestedDataTable"])
})();

如果我将切换2个功能的顺序,它也不起作用。 它没有任何意义,但是,嘿,我是新手;)

有人可能会想到可能是什么原因吗?

1 个答案:

答案 0 :(得分:0)

这是由于我的错(我提到的Newbe)忘了将正确的js文件添加到index.html

相关问题