AngularJs中My97WdatePicker时间控件处理显示星期几

1.class中定义过滤

2.配置文件中获取

$(document).delegate(".dateformatlddt",'focus',function(){
        var format=$(this).attr('ht-date') ||'yyyy-MM-dd';
        WdatePicker({dateFmt:format,alwaysUseStartDate:true,onpicked:onpickedAndClearedforLDDT,oncleared:onpickedAndClearedforLDDT});
        $(this).blur();
    });

3。函数处理赋值

var onpickedAndClearedforLDDT = function(){
    var ngModel = $(this).attr("ng-Model");
    if(!ngModel) console.info("error! 当前非 angular input 环境。无法为ngModel 赋值");
    var scope = angular.element(this).scope();
    var val =$(this).val();
    var weekDay = ["星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
    var myDate = new Date(Date.parse(val));
    var weekn = weekDay[myDate.getDay()];
    scope.$apply(function(){
        eval("scope."+ngModel+"='"+val+"'");
        eval("scope.data.fxq='"+weekn+"'");
    });
};

猜你喜欢

转载自blog.csdn.net/ke_new/article/details/96870843