Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

docs($animate): misleading $animate.cancel example #10498

Closed
wants to merge 1 commit into from

Conversation

olexme
Copy link
Contributor

@olexme olexme commented Dec 17, 2014

The given example is wrong, you can't cancel promise returned by "then" but you can do it for promise returned by "addClass".

The given example is wrong, you can't cancel promise returned by "then" but you can do it for promise returned by "addClass".
@googlebot
Copy link

Thanks for your pull request.

It looks like this may be your first contribution to a Google open source project, in which case you'll need to sign a Contributor License Agreement (CLA) at https://cla.developers.google.com/.

If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check the information on your CLA or see this help article on setting the email on your git commits.

Once you've done that, please reply here to let us know. If you signed the CLA as a corporation, please let us know the company's name.

@petebacondarwin
Copy link
Contributor

LGTM - can be merged once the CLA is signed

@olexme
Copy link
Contributor Author

olexme commented Dec 17, 2014

CLA already signed

@googlebot
Copy link

CLAs look good, thanks!

@caitp
Copy link
Contributor

caitp commented Dec 17, 2014

this is correct, but it really shouldn't be --- this is more of a bug in $q than anything else :( affects $http promises too.

@petebacondarwin
Copy link
Contributor

I don't see this as a bug in $q. The then handler creates a new promise. Are you saying that the $aminate.cancel(promise) method should be able to traverse back up the originating promise chain to find if any of them happened to be promises created by calling addClass?

@petebacondarwin
Copy link
Contributor

So I see in the implementation that there is a $$cancelFn attached to the original promise. @caitp - are you suggesting that $q ought to somehow pass these extra properties along when calling then?

@caitp
Copy link
Contributor

caitp commented Dec 17, 2014

yes, I think so. It would make a hell of a lot more sense than what we do now

@petebacondarwin
Copy link
Contributor

How would it know to do this? Perhaps a convention?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants