2016-02-04 132 views
1

我尝试使用角度带的工具提示时遇到此错误。任何想法为什么会发生以及如何解决它?404找不到角度带

GET http://localhost:3000/tooltip/tooltip.tpl.html 404 (Not Found) 

我的代码看起来像;

var initTooltipAge = function() { 
      // Tooltip Validation workaround https://github.com/mgcrea/angular-strap/issues/106 
      var inputAge = document.getElementById('input-age'); 
      if (inputAge) { 
       var tooltipAge = this.$tooltip(angular.element(inputAge), { 
        title: "blabla", 
        placement: 'top', 
        trigger: 'manual', 
        style: 'alert' 
       }); 
      } 
+0

为什么你自己操纵DOM和不使用角度指令呢? – charlietfl

回答

1

您忘了装载模板文件:

负荷(不需要引导脚本文件)所需的JavaScript库。

<script src="//cdnjs.cloudflare.com/ajax/libs/angular-strap/v2.3.7/angular-strap.min.js"></script> 
<script src="//cdnjs.cloudflare.com/ajax/libs/angular-strap/v2.3.7/angular-strap.tpl.min.js"></script> 

由于模板文件未加载,templateCache不进给,以angularjs将尝试获取资源中的配置,该指令:

templateUrl: 'tooltip/tooltip.tpl.html', 
+0

我确实只是与鲍尔..主要“:[ ”dist/angular-strap.js“, ”dist/angular-strap.tpl.js“ ], –

+0

你做错了什么。如果templateCache有'/tooltip/tooltip.tpl.html'它不会尝试再次获取它.. – enapupe

+0

对不起,我修正了它,但现在我得到“无法读取属性”的链接'从该行中的undefined“ tipElement = $ tooltip。$ element = compileData.link(tipScope,function(clonedElement,scope){}); –