indrimuska / angular-moment-picker

Angular Moment Picker is an AngularJS directive for date and time picker using Moment.js.
http://indrimuska.github.io/angular-moment-picker/
MIT License
525 stars 226 forks source link

Error changing route on change event #219

Open miscillo opened 7 years ago

miscillo commented 7 years ago

Hi.

I need to build a page that on changing a date, it will go to a specific page (using angular ui router).

I add this html code <input class="form-control" change="onChange(date)" ng-model="date" placeholder="Select a date..." format= "DD/MM/YYYY" moment-picker="date">

and the onChange function is like this: $scope.onChange = function(date){ var date = moment(date, "DD/MM/YYYY"); $state.go('list', {day: date.get('date'), month: (date.get('month')+1), year: date.get('year')}) }

But In console I have this error VM3314:27 TypeError: Cannot read property 'removeChild' of null at close (angular-moment-picker.min.js:formatted:299) at angular.js:20440 at e (angular.js:6362) at angular.js:6642 VM3314:27 TypeError: Cannot read property 'removeChild' of null at close (angular-moment-picker.min.js:formatted:299) at angular.js:20440 at e (angular.js:6362) at angular.js:6642 "Possibly unhandled rejection: {}"

I discover that delaying the $state.go function is enogh to avoid this error.