-
Notifications
You must be signed in to change notification settings - Fork 0
/
mobile_start.html
46 lines (44 loc) · 1.26 KB
/
mobile_start.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>手机尾数显示*</title>
<script src="./org/angular.min.js"></script>
<script src="./org/underscore-min.js" ></script>
<link rel="stylesheet" href="./org/bootstrap.min.css">
<link rel="stylesheet" href="./org/font-awesome/css/font-awesome.min.css">
</head>
<body>
<div ng-app="hd" ng-controller="ctrl">
<table border="1px" width="60%">
<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 | trucnate}}</td>
<!--<td>{{v.mobile | trucnate:2}}</td>-->
</tr>
</table>
</div>
<script>
var m = angular.module('hd', []);
m.filter('trucnate', function(){
return function(mobile, len){
len = len ? len : 4;
return mobile.substr(0,11 - len) + new String('*').repeat(len);
}
})
m.controller('ctrl', ['$scope', function ($scope) {
$scope.data = [
{id:1,name:'小明',mobile:'15632548754'},
{id:2,name:'小华',mobile:'13659874521'},
{id:3,name:'唐僧',mobile:'16999999999'}
];
}]);
</script>
</body>
</html>