首页 > Web开发 > 详细

anjularjs-filter,directer

时间:2017-06-25 09:54:05      阅读:381      评论:0      收藏:0      [点我收藏+]

1、过滤器

<!doctype html>
<!-- ng-app使用范围HTML -->
<html lang="en" ng-app="test">  
<head>
    <meta <meta charset=" " set="UTF-8">
    <title>Document</title>
    <style type="text/css" media="screen">
        #div1 input {background: #CCC;}
        #div1 input.active {background: yellow;}
        #div1 div {width: 200px;height: 200px;border: 1px solid #000;}
    </style>
    <script src="angular.min.js"></script>
    <script type="text/javascript">
        var app=angular.module(‘test‘, []) 
        app.controller(‘cont1‘,  function($scope){
            $scope.arr=[12.4,12,3,44]
            $scope.timer=12341341234
        })

        app.filter(‘my_filter‘,function () {
            //只执行一次,进行初始化
            //alter()
            return  function (input) {
                //执行多次
                return input+19
            }
        })

    </script>
    <style type="text/css" media="screen">
    </style>
</head>
<body ng-controller="cont1">    
    <ul>
        <li ng-repeat="v in arr">{{v|my_filter}}:{{timer|date:‘yyyy年MM月dd日‘}}</li>
    </ul>
</body>
</html>


anjularjs-filter,directer

原文:http://f1yinsky.blog.51cto.com/12568071/1941622

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!