码迷,mamicode.com
首页 > 其他好文 > 详细

angular filter

时间:2015-09-22 16:39:41      阅读:141      评论:0      收藏:0      [点我收藏+]

标签:

日期格式化:

<span ng-bind="topShowList.sendTime|dateFormat|date:‘MM-dd HH:mm‘"></span>

deliciousApp.filter("dateFormat",[function(){ return function(time){ return new Date(Date.parse(time.replace(/-/g, "/"))); } }]); 注意:topShowList.sendTime是string类型的日期, 例如“2015-08-09 112030”

两个参数的filter:

<span ng-bind="voucherList.voucherLot.isFreeShip | limitOption:voucherList.voucherLot.orderMoney"></span>

app.filter("limitOption",function(){
               return function(isFreeShip,orderMoney){                                
                   if(isFreeShip==1 && orderMoney>0){
                     return "包邮,订单满"+orderMoney+"元可用";                   
                   }else if(isFreeShip==1 && orderMoney==0){
                      return "包邮";
                   }else if(isFreeShip==0 && orderMoney==0){
                     return "无限制";
                   }else if(isFreeShip==0 && orderMoney>0){
                     return "订单满"+orderMoney+"元可用";
                   }
               }
           });

  

  

<em class="price" ng-bind="goodsList.skuInfo.isPromotion !=‘0‘ ?goodsList.skuInfo.promotionPrice:goodsList.skuInfo.theOriginalPrice | currency : ‘¥‘ "></em>
结果:¥16.8

  

  

angular filter

标签:

原文地址:http://www.cnblogs.com/xiaotaiyang/p/4829116.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!