The My97WdatePicker time control in AngularJs handles displaying the day of the week

1. Define filtering in class

2. Obtained from the configuration file

$(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. Function handling assignment

var onpickedAndClearedforLDDT = function(){ 
    var ngModel = $(this).attr("ng-Model"); 
    if(!ngModel) console.info("error! The current non-angular input environment. Cannot assign a value to ngModel"); 
    var scope = angular.element(this).scope(); 
    var val =$(this).val(); 
    var weekDay = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; 
    var myDate = new Date(Date.parse(val)); 
    var weekn = weekDay[myDate.getDay()]; 
    scope.$apply(function(){ 
        eval("scope." +ngModel+"='"+val+"'"); 
        eval("scope.data.fxq='"+weekn+"'"); 
    }); 
};

Guess you like

Origin blog.csdn.net/ke_new/article/details/96870843