美文网首页
自定义过滤器

自定义过滤器

作者: c59ffede9db6 | 来源:发表于2017-04-22 01:26 被阅读0次
Window {external: Object, chrome: Object, document: document, angular: Object, app: Object…}
index.html:19 [122525.54545744, 1, 2]
<!DOCTYPE html>
<html ng-app='test'>
  <head>
    <meta charset="utf-8">
    <title>angular</title>
    <script src='bower_components/angular/angular.js'>
    </script>
    <script>
      var app=angular.module('test',[]);
      app.controller('con1',function($scope,$http){
          $scope.a='asdFsfsXW'
          $scope.b='SWEeFAcFFS'
          $scope.c=122525.54545744

      })
      app.filter('todo',function(){
        return function(){
          console.log(this)
          console.log(arguments)
        }
      })
    </script>
  </head>
  <body ng-controller='con1'>
    {{a|uppercase}}
    <p>{{b|lowercase}}</p>
    {{a|limitTo:2}}
    {{c|number:4}} //数字过滤器默认保留3位小数,最后一位四舍五入
    {{c|todo:1:2}} //Window {external: Object, chrome: Object, document: document, angular: Object, app: Object…}
index.html:19 [122525.54545744, 1, 2]
  </body>
</html>

相关文章

网友评论

      本文标题:自定义过滤器

      本文链接:https://www.haomeiwen.com/subject/xiwjzttx.html