Open tlenex opened 7 years ago
The problem is that $timeout puts a promise in $digest cycle. But when the scope which holds datetimepicker is destroyed, also does the model. So, in the end (after local scope is destroyed), $digest finds a promise and executes it. This promise calls $setViewValue on a model that dont exist anymore (its scope is destroyed). So, to solve this you should do something like this:
var promise = $timeout(...);
scope.$on('$destroy', function() {
$timeout.cancel(promise);
$element.off();
});
Worked for me.
This error is called on this line:
I think
$setViewValue
should be wrapped in something like this:and if should remove listeners by
$element.off
with the event handler on$scope.$on('$destroy', ...)