3 ms·
> I love the ability to set a set a promise for the timeout parameter. please explain .
by aikah 12y ago
> I love the ability to set a set a promise for the timeout parameter.
please explain .
- Arnavion 12y agoI assume the grandparent is talking about functions in Angular that take in a numeric timeout parameter and wants them to take in Promises instead, so he can reject the promises to signal that he wants to cancel the operation. Kinda like CancellationToken in .Net, I guess.
- bengarvey 12y agoYou can pass a promise into an $http request as a parameter. If you hold on to this promise and resolve it before the request returns, it cancels the request. https://docs.angularjs.org/api/ng/service/$http https://docs.angularjs.org/api/ng/service/$http