本代码转自向军老师的angularjs课程
<!DOCTYPE html>
<html lang="en" ng-app="hd">
<head>
<title></title>
<script type="text/javascript" src="js/angular-1.3.0.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
</head>
<body>
<div ng-controller="ctrl">
<table border="1" width="600">
<tr>
<td>编号</td>
<td>姓名</td>
<td>手机号</td>
</tr>
<tr ng-repeat = "(k,v) in data">
<td>{{v.id}}</td>
<td>{{v.name}}</td>
<td>{{v.mobile | truncate:6}}</td>
</tr>
</table>
</div>
<script type="text/javascript">
var m = angular.module('hd',[]);
m.filter('truncate',function(){
return function(mobile,len){
len = len?len:3;
return mobile.substr(0,11-len)+new String('*').repeat(len);
}
});
m.controller('ctrl',['$scope','$http','$filter',function($scope,$http,$filter){
$scope.data = [
{id:1,name:'刘畅',mobile:'13544664646'},
{id:2,name:'王桢',mobile:'13589898989'},
{id:3,name:'梁志勇',mobile:'13588881234'},
{id:4,name:'钱行',mobile:'13598092735'}
];
}]);
</script>
</body>
</html>