如何用angularjs给从后台传来数据添加链接
1个回答
展开全部
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<meta charset="UTF-8">
<title>angular</title>
</head>
<body ng-controller="myCtrl">
<table>
<tr ng-repeat="name in names">
<td><a href="http://{{name.url}}" target="_blank">{{name.name}}</a><div style="display:none">{{name.url}}</div></td>
<td ng-bind="name.age"></td>
<td ng-bind="name.sex"></td>
</tr>
</table>
</body>
<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/angular.min.js"></script>
<script>
angular.module('myApp',[]).controller('myCtrl',function($scope){
$scope.names=[{
"name": "xiaohaong",
"age": 12,
"sex": "女",
"url":"www.trs.com.cn"
},
{
<html ng-app="myApp">
<head>
<meta charset="UTF-8">
<title>angular</title>
</head>
<body ng-controller="myCtrl">
<table>
<tr ng-repeat="name in names">
<td><a href="http://{{name.url}}" target="_blank">{{name.name}}</a><div style="display:none">{{name.url}}</div></td>
<td ng-bind="name.age"></td>
<td ng-bind="name.sex"></td>
</tr>
</table>
</body>
<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/angular.min.js"></script>
<script>
angular.module('myApp',[]).controller('myCtrl',function($scope){
$scope.names=[{
"name": "xiaohaong",
"age": 12,
"sex": "女",
"url":"www.trs.com.cn"
},
{
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询