Skip to content

Commit 7d70dcd

Browse files
olexmepetebacondarwin
authored andcommitted
docs($animate): fix misleading $animate.cancel example
The given example is wrong, you can't cancel the promise returned by "then" since it is not the one originally tracked by "addClass". Closes angular#10498
1 parent 9e6161e commit 7d70dcd

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎src/ngAnimate/animate.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,8 @@ angular.module('ngAnimate', ['ng'])
833833
* promise that was returned when the animation was started.
834834
*
835835
* ```js
836-
* var promise = $animate.addClass(element, 'super-long-animation').then(function() {
836+
* var promise = $animate.addClass(element, 'super-long-animation');
837+
* promise.then(function() {
837838
* //this will still be called even if cancelled
838839
* });
839840
*

0 commit comments

Comments
 (0)