1. 目录结构
![这里写图片描述](https://img-blog.csdn.net/20170125001206825?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQva2lzc2xvdHVz/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
2. e.g.
a. Filter.html
<html ng-app="MyModule">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script src="framework/angular-1.3.0.14/angular.js"></script>
<script src="Filter.js"></script>
</head>
<body>
{{ 1304375948024 | date }}
<br>
{{ 1304375948024 | date:"MM/dd/yyyy @ h:mma" }}
<br>
{{ 1304375948024 | date:"yyyy-MM-dd hh:mm:ss" }}
<br>
</body>
</html>
b. Filter.js
var myModule=angular.module("MyModule",[]);
3. 自定义Filter
a. e.g.
i. MyFilter.html
<html ng-app="MyModule">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script src="framework/angular-1.3.0.14/angular.js"></script>
<script src="MyFilter.js"></script>
</head>
<body>
{{'大漠穷秋'|filter1 }}
</body>
</html>
ii. MyFilter.js
var myModule=angular.module("MyModule",[]);
myModule.filter('filter1',function(){
return function(item){
return item + 'o(∩_∩)o';
}
});