<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>
<script>
var myModule=angular.module("MyModule",[]);
</script>
<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>
{{'orchome'|filter1 }}
</body>
</html>
js
var myModule=angular.module("MyModule",[]);
myModule.filter('filter1',function(){
return function(item){
return item + 'o(∩_∩)o';
}
});
结果:
orchomeo(∩_∩)o