欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

angularJs自定義過濾器實(shí)現(xiàn)手機(jī)號(hào)信息隱藏的方法

 更新時(shí)間:2018年10月08日 11:15:50   作者:泠泠在路上  
今天小編就為大家分享一篇angularJs自定義過濾器實(shí)現(xiàn)手機(jī)號(hào)信息隱藏的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧

如下所示:

<div ng-app="module" ng-controller="ctrl">
 <table border="1" width="600">
  <tr>
   <td>編號(hào)</td>
   <td>姓名</td>
   <td>手機(jī)號(hào)</td>
  </tr>
  <tr ng-repeat="(k,v) in data">
   <td>{{v.id}}</td>
   <td>{{v.name}}</td>
   <td>{{v.mobile|truncate:4}}</td>
  </tr>
 </table>
</div>
<script>
 var m = angular.module('module', []);
/*自定義過濾器truncate*/
 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', '$filter', function ($scope, $filter) {
  $scope.data = [
   {id: 1, name: '張三', mobile: '14567654445'},
   {id: 2, name: '李四', mobile: '13910959565'},
   {id: 3, name: '王五', mobile: '13232343425'},
  ];
 }]);
</script>

效果圖:

angularJs 手機(jī)號(hào)信息隱藏

以上這篇angularJs自定義過濾器實(shí)現(xiàn)手機(jī)號(hào)信息隱藏的方法就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論