不能实例化meanjs样板角甘特图 [英] Can't instantiate angular-gantt chart in meanjs boilerplate

查看:184
本文介绍了不能实例化meanjs样板角甘特图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是比较新的meanstack,我想包括在项目角度的甘特图。我按照所有根据GitHub上的文件的步骤,但我不断收到一些错误。下面是我采取的步骤的简要概述。


  1. 使用安装角的甘特图

    凉亭安装角甘特--save


  2. 我wiredep使用的依赖关系:

    咕噜wiredep


  3. 我增加了资产/角gantt.js和资产/ gant.css到config / ENV / all.js的哟meanjs生成的文件


  4. 我包含模块的甘特在publlic / config.js文件

  5. 我的角应用模块

5。我也跑了咕噜的角甘特文件夹建立角gantt.min.js和角gantt.js
我意识到还包括角gantt.js.map和角gantt.min.js.map

<醇开始=6>
  • 然后我包含在我的HTML指令


  • 最后我包括在我的控制器的操作...


  • 但我一直在得到以下错误

     类型错误:未定义不是一个函数
    在新的控制器(HTTP://本地主机:3000 / lib目录/角甘特/资产/角gantt.js:143:43)
    在Object.invoke(HTTP://本地主机:3000 / lib目录/角/ angular.js:4118:17)
    在extend.instance(HTTP://本地主机:3000 / lib目录/角/ angular.js:8312:21)
    在http://本地主机:3000 / lib目录/角/ angular.js:7564:13
    在的forEach(HTTP://本地主机:3000 / lib目录/角/ angular.js:347:20)
    在nodeLinkFn(HTTP://本地主机:3000 / lib目录/角/ angular.js:7563:11)
    在http://本地主机:3000 / lib目录/角/ angular.js:7824:13
    在processQueue(HTTP://本地主机:3000 / lib目录/角/ angular.js:12901:27)
    在http://本地主机:3000 / lib目录/角/ angular.js:12917:27
    在范围$的eval(HTTP://本地主机:3000 / lib目录/角/ angular.js:14110:28)。

     错误:[$编译:multidir]多个指令[ganttTaskProgress,进度]要求模板:LT; D​​IV CLASS =甘特任务正在进行的NG式=getCss ()NG-CLASS =progress.classesNG-如果=task.progress ==未定义进步=task.progress&GT!; 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
    在http://本地主机:3000 / lib目录/角/ angular.js:80:12


    解决方案

    我可以解决你的第二个错误。 GANT有一个名为ganttTaskProgress指令,它有一个名为进步的属性。引导有一个名为进步指令,它匹配的属性。因此角抛出一个错误,因为它不能同时模板应用到的元素。如果你不使用引导程序,然后你要通过库搜索,看看是否有一个叫'进步'的指令,然后更改其名称或者其注释掉。

    I'm relatively new to meanstack and i'm trying to include an angular-gantt chart in a project. i have followed all the steps according to the documentation on github but i keep getting some errors. Here's a brief overview of the steps i took.

    1. Install the angular-gantt chart using

      bower install angular-gantt --save

    2. I wiredep the dependencies using:

      grunt wiredep

    3. I added the asset/angular-gantt.js and the asset/gant.css to the config/env/all.js file generated by yo meanjs

    4. I Include the module gantt to my Angular app modules in the publlic/config.js file

    5.I also ran grunt in the angular-gantt folder to build the angular-gantt.min.js and angular-gantt.js which i realised also included angular-gantt.js.map and angular-gantt.min.js.map

    1. I then included the directive in my html

    2. Finally i included the operations in my controller...

    But i keep on getting the following errors

     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)
    

    and

    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
    

    解决方案

    I can solve your second error. Gant has a directive called 'ganttTaskProgress' which has an attribute called 'progress'. Bootstrap has a directive called 'progress' which matches attributes. Angular therefore throws an error, as it can't apply both templates to the element. If you're not using bootstrap then have a search through your libraries and see if there's a directive called 'progress', then change its name or comment it out.

    这篇关于不能实例化meanjs样板角甘特图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆