angular $filter 自定义显示当前时间

来源:互联网 发布:淘宝女舞蹈裤 编辑:程序博客网 时间:2024/06/01 23:32
<script>
        var ycapp=angular.module("ycapp",[]);
        ycapp.factory("shotime",["$filter",function($filter){
            var fdate=$filter("date");
            var now=new Date();
            return fdate(now,"yyyy-MM-dd-hh-mm-ss")
        }]);
        ycapp.controller("dema",["$scope","shotime",function($scope,shotime){
            $scope.now=shotime;
            
        }]);
        
    </script>
原创粉丝点击