<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<style type="text/css">
.ms-controller {
visibility: hidden;
}
</style>
<script src="Content/js/avalon.js"></script>
</head>
<body>
<div ms-controller="filter">
<%--输出html格式--%>
<span>{{aaa|html}}</span><br />
<br />
<%--字母大写化--%>
<span>{{bbb|uppercase}}</span><br />
<br />
<%--字母小写化--%>
<span>{{ccc|lowercase}}</span><br />
<br />
<%--从头开始截取5个字符,位数使用后面的字符串填充--%>
<span>{{ddd|truncate(5,'00')}}</span><br />
<br />
<%--驼峰处理--%>
<span>{{eee|camelize}}</span><br />
<br />
<%--货币处理--%>
<span>{{fff|currency('$')}}</span><br />
<br />
<%--2:表示两位小数
.:表示小数点的形式
,:表示千分位的分隔符--%>
<span>{{ggg|number(2)}}</span><br />
<br />
<span>{{ggg|number(2,".")}}</span><br />
<br />
<span>{{ggg|number(2,".",",")}}</span><br />
<br />
<%--时间过滤器--%>
<span>{{new Date|date("yyyy MM dd HH:mm:ss a")}}</span><br />
<br />
<span>{{"2011-07-08"|date("EEE MM dd yyyy")}}</span><br />
<br />
<%--时间戳转换--%>
<span>{{"1373021259229"|date("yyyy年MM月dd日")}}</span><br />
<br />
<span>{{"1373021259229"|date("yyyy-MM-dd HH:mm:ss a")}}</span><br />
<br />
<span>{{"1373021259229"|date("yyyy-MM-dd mm:ss")}}</span><br />
<br />
<span>USD:{{"USD"|parseSymbol}}</span><br />
</div>
</body>
<script type="text/javascript">
avalon.filters.parseSymbol = function (str) {
return {
'元': '元',
'USD': '美元',
'HKD': '港元'
}[str];
}
var vm = avalon.define({
$id: "filter",
aaa: "<span>hello avalon!</span>",
bbb: "字母大写化:hello avalon!",
ccc: "字母小写化:HELLO AVALON!",
ddd: "字符串截断处理",
eee: "驼峰处理:abc-def-hig",
fff: "2255",
ggg: "546345.541343",
});
</script>
</html>