How to wrap the datetimepicker js into AngularJS directive

前端 未结 7 2185
陌清茗
陌清茗 2020-12-15 01:59

I have spent sometime on researching the existing datetime directives of angularjs.

Both ngularUI and AngularStrap do not provide a datetimepicker as I needed. Of co

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-15 02:15

    I am also using DateTimePicker by Angular Directive and it is working fine here. I tried it in this way:

    element.datetimepicker({
                            timepicker:false,
                            format:'Y-m-d', 
                            formatDate:'Y-m-d',
                            closeOnDateSelect: true,
                            onChangeDateTime: function(dp, $input){
                                var val = $input['context']['value'];  
                                ctrl.$setViewValue(val); 
                                ctrl.$render();  
                                scope.$apply(); 
                            } 
        //                  minDate:'-1970/01/02', // yesterday is minimum date
                            //maxDate:'+1970/01/02' // and tommorow is maximum date calendar
                        });
    

提交回复
热议问题