fragaria / angular-daterangepicker

Angular.js wrapper for dangrossman/bootstrap-daterangepicker
MIT License
519 stars 372 forks source link

fix the ng-change bug #194

Closed elvismacak closed 5 years ago

elvismacak commented 8 years ago

I think you there is something wrong with the NgModelController.

you use the following function to response the datepicker callback, and update the $scope.model inside this function. But anyway, you didn't change the $modelValue, or $viewValue, so that won't emit the dirty check and won't run the ng-change function.

function(start, end) {
             return $scope.$apply(function() {
              return $scope.model = opts.singleDatePicker ? start : {
                 startDate: start,
                 endDate: end
               };
            });

So I add this to trigger it. modelCtrl.$modelValue = $scope.model modelCtrl.$validate()

Also this is not a better way to do that. Hope to update this in the future.

vjoao commented 8 years ago

Will this ever be merged?