douqinlu4217 2016-07-05 23:27
浏览 163

Href在Javascript函数中不起作用

I have got this code below and I want to know how I can add a clickable link to the boxes under each title.

I want this <a href=" . '"callto://+' . $getTelephone . '"' . ">Call on Skype</a> to appear in the first box. But I cannot get it to work as the whole function just stops working when I add it.

function MyCtrl($scope) {
  $scope.environment_service_packages = 
    [
      {name: 'obj1', info: {text: '<?php echo "A html link below \
\
 Call on Skype"; ?>', show: true}},
      {name: 'obj2', info: {text: 'some extra info for obj2', show: true}},
      {name: 'obj3', info: {text: 'some extra info for obj3', show: true}},
      {name: 'obj4', info: {text: 'some extra info for obj4', show: false}},
    ];
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>

<body ng-app>
  <table ng-controller="MyCtrl" class="table table-hover table-striped">
    <tr class="info">
      <td>...</td>
    </tr>
    <tbody ng-repeat="x in environment_service_packages">
      <tr ng-click="x.info.show = !x.info.show">
        <td> {{ x.name }}
      </tr>
      <tr ng-show="x.info.show">
        <td>
          <pre>{{ x.info.text }}</pre>
        </td>
      </tr>
    </tbody>
  </table>
</body>

</div>
  • 写回答

2条回答 默认 最新

  • dongteng2534 2016-07-05 23:37
    关注

    Putting ng-repeat on the tbody will create a body for every member in the array.

    Try putting ng-repeat-start on the first row and ng-repeat-end on the second row.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog