2014-11-04 38 views
0

我對meanstack比較陌生,我試圖在項目中包含角甘特圖。根據github上的文檔,我遵循了所有的步驟,但是我一直在收到一些錯誤。以下是我採取的步驟的簡要概述。無法在meanjs樣板中實例化角甘特圖

  1. 安裝使用

    亭子安裝角的甘特--save

  2. 我使用wiredep的依賴關係的角度的甘特圖:

    咕嚕wiredep

  3. 我加asset/angular-gantt.js和asset/gant.css到由yo生成的config/env/all.js文件,意思是

  4. 我附上模塊甘特在publlic我的角應用模塊/文件config.js

5.I也跑咕嚕在角的甘特夾建立所述角度gantt.min的.js並且我意識到也包括角gantt.js angular-gantt.js.map和angular-gantt.min.js.map

  • 我隨後包括該指令在我的html

  • Fin盟友我包括在我的控制器的操作...

  • ,但我一直在收到以下錯誤

    TypeError: undefined is not a function 
    at new controller (http://localhost:3000/lib/angular-gantt/assets/angular-gantt.js:143:43) 
    at Object.invoke (http://localhost:3000/lib/angular/angular.js:4118:17) 
    at extend.instance (http://localhost:3000/lib/angular/angular.js:8312:21) 
    at http://localhost:3000/lib/angular/angular.js:7564:13 
    at forEach (http://localhost:3000/lib/angular/angular.js:347:20) 
    at nodeLinkFn (http://localhost:3000/lib/angular/angular.js:7563:11) 
    at http://localhost:3000/lib/angular/angular.js:7824:13 
    at processQueue (http://localhost:3000/lib/angular/angular.js:12901:27) 
    at http://localhost:3000/lib/angular/angular.js:12917:27 
    at Scope.$eval (http://localhost:3000/lib/angular/angular.js:14110:28) 
    

    Error: [$compile:multidir] Multiple directives [ganttTaskProgress, progress] asking for template   on: <div class="gantt-task-progress" ng-style="getCss()" ng-class="progress.classes" ng- if="task.progress !== undefined" progress="task.progress"> http://errors.angularjs.org/1.3.1/$compile/multidir?p0=ganttTaskProgress&p1…task.progress%20!%3D%3D%20undefined%22%20progress%3D%22task.progress%22%3E 
    at http://localhost:3000/lib/angular/angular.js:80:12 
    

    回答

    1

    我可以解決你的第二個錯誤。 Gant有一個叫做'ganttTaskProgress'的指令,它有一個名爲'progress'的屬性。 Bootstrap有一個名爲'progress'的指令,它與屬性匹配。因此Angular會拋出一個錯誤,因爲它無法將兩個模板都應用到元素。如果你沒有使用bootstrap,那麼在你的庫中搜索一下,看看是否有一個叫'progress'的指令,然後改名或者註釋掉它。

    +0

    嗨,我是角甘特的作者。此問題已被報告,現在已解決。我們已將每個指令和服務名稱用「甘特圖」作爲前綴以避免這些問題。 – Toilal 2014-12-01 06:44:01