How to wrap the datetimepicker js into AngularJS directive

前端 未结 7 2170
陌清茗
陌清茗 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:07

    A possible solution to problem 1:

    You will need to set the view value to the date that is in the model right from the beginning, by doing something like this:

    if (ngModel.$viewValue) {
    
      picker.data("DateTimePicker").setDate(new Date(ngModel.$modelValue));'
    
      picker.on('change', function(e) {
    
        ....
    
      });
    
    }
    

提交回复
热议问题