Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript ng单击“在引导popover内容中不工作”_Javascript_Angularjs_Twitter Bootstrap - Fatal编程技术网

Javascript ng单击“在引导popover内容中不工作”

Javascript ng单击“在引导popover内容中不工作”,javascript,angularjs,twitter-bootstrap,Javascript,Angularjs,Twitter Bootstrap,我想在弹出窗口中显示一个可单击的表,并在单击其中一行时调用函数。我的html如下所示: <a popover id="showDays" type="button" class="btn btn-success btn-xs pull-left" data-toggle="popover" data-placement="right" data-html="true" title="Popover title" data-conte

我想在弹出窗口中显示一个可单击的表,并在单击其中一行时调用函数。我的html如下所示:

<a popover  id="showDays"
    type="button"
    class="btn btn-success btn-xs pull-left"
    data-toggle="popover"
    data-placement="right"
    data-html="true"
    title="Popover title"
    data-content=
    '<table class="table table-condensed">
       <tbody>
         <tr ng-repeat="d in days" ng-click="show(111)">
           <td ng-bind="d"></td>
           <td ng-bind="x"></td>
         </tr>
       </tbody>
     </table>'>
      <i class="fa fa-clock-o fa-lg">Click me</i>
 </a>


代码是从中复制的,答案本身工作正常,但我的
show
函数未被调用。知道为什么吗?

我发现了这个问题,由于某种原因,指令未能将函数
show
绑定到
范围
,但在
成功,我做了一些试验,如果我改变
链接
函数的编写方式,ng click将起作用,但不会重复ng,这意味着在这种情况下,它无法绑定

更新后的模板使用templateUrl而不是数据内容属性

<script type="text/ng-template" id="popover-content">
     <table class="table table-condensed">
       <tbody>
         <tr ng-repeat="d in days" role="button" ng-click="show(111)">
           <td ng-bind="d"></td>
           <td ng-bind="x"></td>
         </tr>
       </tbody>
     </table>
    </script>


现在,ng repeat和ng click对我来说都可以正常工作。

标记为“为什么此代码不工作”@AlexandreMartin,这是什么意思?我还应该怎么问这个问题呢?你没有使用
ui引导
popover
element@PankajParkar,不,我只想使用引导,它应该能够做到这一点。
<script type="text/ng-template" id="popover-content">
     <table class="table table-condensed">
       <tbody>
         <tr ng-repeat="d in days" role="button" ng-click="show(111)">
           <td ng-bind="d"></td>
           <td ng-bind="x"></td>
         </tr>
       </tbody>
     </table>
    </script>