I have a method which is using evalAsync and I would like to set a maximum waiting time for the promise to be resolved, if the waiting time reaches the max timeout then the promise will be resolved and returned empty. Any ideas about how to accomplish this?
It's being hard to find solutions as every search with the terms evalasync and timeout, "pollutes" the results with $timeout.
if (angular.isFunction(this.search)) {
this.cancellation = this.$q.defer<void>();
this.$scope.$evalAsync(() => {
const searchArgs= {
value: this.value,
cancellation: this.cancellation.promise
};
const result = this.search(args);
});
}
};
Thanks
setTimeout(Not$timeoutto prevent a new digest cycle, and rejectthis._cancellationoutsidethis.$scope.$evalAsync,