From fa7ae21e50182b9d5a9714917557a74a9c13261c Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Sat, 5 May 2018 13:28:59 +0300 Subject: [PATCH] docs(migration.ngdoc): add missing breaking changes from #16476 --- docs/content/guide/migration.ngdoc | 52 ++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/docs/content/guide/migration.ngdoc b/docs/content/guide/migration.ngdoc index a4140e409fb4..376295665999 100644 --- a/docs/content/guide/migration.ngdoc +++ b/docs/content/guide/migration.ngdoc @@ -364,6 +364,58 @@ Where now the `oldValue` will always equal the previous `newValue`: | `a=b=3` | [3, 2] | [1, 2] | +#### **$interval** + +**Due to [a8bef9](https://github.com/angular/angular.js/commit/a8bef95127775d83d80daa4617c33227c4b443d4)**, +`$interval.cancel() will throw an error if called with a promise that was not generated by +`$interval()`. Previously, it would silently do nothing. + +Before: +```js +var promise = $interval(doSomething, 1000, 5).then(doSomethingElse); +$interval.cancel(promise); // No error; interval NOT canceled. +``` + +After: +```js +var promise = $interval(doSomething, 1000, 5).then(doSomethingElse); +$interval.cancel(promise); // Throws error. +``` + +Correct usage: +```js +var promise = $interval(doSomething, 1000, 5); +var newPromise = promise.then(doSomethingElse); +$interval.cancel(promise); // Interval canceled. +``` + + +#### **$timeout** + +**Due to [336525](https://github.com/angular/angular.js/commit/3365256502344970f86355d3ace1cb4251ae9828)**, +`$timeout.cancel() will throw an error if called with a promise that was not generated by +`$timeout()`. Previously, it would silently do nothing. + +Before: +```js +var promise = $timeout(doSomething, 1000).then(doSomethingElse); +$timeout.cancel(promise); // No error; timeout NOT canceled. +``` + +After: +```js +var promise = $timeout(doSomething, 1000).then(doSomethingElse); +$timeout.cancel(promise); // Throws error. +``` + +Correct usage: +```js +var promise = $timeout(doSomething, 1000); +var newPromise = promise.then(doSomethingElse); +$timeout.cancel(promise); // Timeout canceled. +``` + + #### **$cookies** **Due to [73c646](https://github.com/angular/angular.js/commit/73c6467f1468353215dc689c019ed83aa4993c77)**, the `$cookieStore`service has been removed. Migrate to the $cookies service. Note that