2015-09-17 75 views
0

首先,我對AngularJS非常非常陌生,所以它可能是一個新問題。應用程序依賴的奇怪行爲AngularJS

我有我的應用程序依賴關係的聲明,在我的app.js文件:

(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個功能的順序。 它沒有任何意義,但嘿,我是一個新生;)

有人可以想到的東西,可能是原因?

+0

你在應用程序的自舉控制檯得到一個錯誤?也許語法逗號錯誤?在你的第一個代碼片段中,你有一個額外的尾隨逗號,它不應該在那裏。 –

+0

是的,我知道,這是我在這裏犯的一個錯誤,但額外的逗號不在我的代碼中。 – TBE

回答

0

這是由於我的過錯(Newbe正如我提到的)忘了加上適當的js文件的index.html