2014-11-04 36 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