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
olexme wants to merge 1 commit into
angular:masterfrom
olexme:patch-1
Closed

olexme wants to merge 1 commit into
angular:masterfrom
olexme:patch-1

Conversation

@olexme

@olexme olexme commented Dec 17, 2014

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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
Copy Markdown
Contributor

LGTM - can be merged once the CLA is signed

@olexme

olexme commented Dec 17, 2014

Copy link
Copy Markdown
Contributor Author

CLA already signed

@googlebot

Copy link
Copy Markdown

CLAs look good, thanks!

@caitp

caitp commented Dec 17, 2014

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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

caitp commented Dec 17, 2014

Copy link
Copy Markdown
Contributor

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

@petebacondarwin

Copy link
Copy Markdown
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