简体   繁体   中英

Href not working within Javascript function

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> <a href=" . '"callto://+' . $getTelephone . '"' . ">Call on Skype</a> <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 \\\\n\\\\n 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> 

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.

您无法在客户端运行PHP代码...您需要将HTML更改为:

<a href="callto://{{this.come.from.angular.getTelephone }}">Call on Skype</a>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM