Skip to content

Commit d498199

Browse files
Merge pull request #68 from angular/master
Update upstream
2 parents 4bd7a8d + 98e0e04 commit d498199

File tree

7 files changed

+318
-195
lines changed

7 files changed

+318
-195
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
@ngdoc error
2+
@name $interval:badprom
3+
@fullName Non-$interval promise
4+
@description
5+
6+
This error occurs when calling {@link ng.$interval#cancel $interval.cancel()} with a promise that
7+
was not generated by the {@link ng.$interval $interval} service. This can, for example, happen when
8+
calling {@link ng.$q#the-promise-api then()/catch()} on the returned promise, which creates a new
9+
promise, and pass that new promise to {@link ng.$interval#cancel $interval.cancel()}.
10+
11+
Example of incorrect usage that leads to this error:
12+
13+
```js
14+
var promise = $interval(doSomething, 1000, 5).then(doSomethingElse);
15+
$interval.cancel(promise);
16+
```
17+
18+
To fix the example above, keep a reference to the promise returned by
19+
{@link ng.$interval $interval()} and pass that to {@link ng.$interval#cancel $interval.cancel()}:
20+
21+
```js
22+
var promise = $interval(doSomething, 1000, 5);
23+
var newPromise = promise.then(doSomethingElse);
24+
$interval.cancel(promise);
25+
```
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
@ngdoc error
2+
@name $timeout:badprom
3+
@fullName Non-$timeout promise
4+
@description
5+
6+
This error occurs when calling {@link ng.$timeout#cancel $timeout.cancel()} with a promise that
7+
was not generated by the {@link ng.$timeout $timeout} service. This can, for example, happen when
8+
calling {@link ng.$q#the-promise-api then()/catch()} on the returned promise, which creates a new
9+
promise, and pass that new promise to {@link ng.$timeout#cancel $timeout.cancel()}.
10+
11+
Example of incorrect usage that leads to this error:
12+
13+
```js
14+
var promise = $timeout(doSomething, 1000).then(doSomethingElse);
15+
$timeout.cancel(promise);
16+
```
17+
18+
To fix the example above, keep a reference to the promise returned by
19+
{@link ng.$timeout $timeout()} and pass that to {@link ng.$timeout#cancel $timeout.cancel()}:
20+
21+
```js
22+
var promise = $timeout(doSomething, 1000);
23+
var newPromise = promise.then(doSomethingElse);
24+
$timeout.cancel(promise);
25+
```

src/ng/directive/ngShowHide.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,25 @@ var NG_HIDE_IN_PROGRESS_CLASS = 'ng-hide-animate';
182182
});
183183
</file>
184184
</example>
185+
*
186+
* @knownIssue
187+
*
188+
* ### Flickering when using ngShow to toggle between elements
189+
*
190+
* When using {@link ngShow} and / or {@link ngHide} to toggle between elements, it can
191+
* happen that both the element to show and the element to hide are visible for a very short time.
192+
*
193+
* This usually happens when the {@link ngAnimate ngAnimate module} is included, but no actual animations
194+
* are defined for {@link ngShow} / {@link ngHide}. Internet Explorer is affected more often than
195+
* other browsers.
196+
*
197+
* There are several way to mitigate this problem:
198+
*
199+
* - {@link guide/animations#how-to-selectively-enable-disable-and-skip-animations Disable animations on the affected elements}.
200+
* - Use {@link ngIf} or {@link ngSwitch} instead of {@link ngShow} / {@link ngHide}.
201+
* - Use the special CSS selector `ng-hide.ng-hide-animate` to set `{display: none}` or similar on the affected elements.
202+
* - Use `ng-class="{'ng-hide': expression}` instead of instead of {@link ngShow} / {@link ngHide}.
203+
* - Define an animation on the affected elements.
185204
*/
186205
var ngShowDirective = ['$animate', function($animate) {
187206
return {
@@ -382,6 +401,25 @@ var ngShowDirective = ['$animate', function($animate) {
382401
});
383402
</file>
384403
</example>
404+
*
405+
* @knownIssue
406+
*
407+
* ### Flickering when using ngHide to toggle between elements
408+
*
409+
* When using {@link ngShow} and / or {@link ngHide} to toggle between elements, it can
410+
* happen that both the element to show and the element to hide are visible for a very short time.
411+
*
412+
* This usually happens when the {@link ngAnimate ngAnimate module} is included, but no actual animations
413+
* are defined for {@link ngShow} / {@link ngHide}. Internet Explorer is affected more often than
414+
* other browsers.
415+
*
416+
* There are several way to mitigate this problem:
417+
*
418+
* - {@link guide/animations#how-to-selectively-enable-disable-and-skip-animations Disable animations on the affected elements}.
419+
* - Use {@link ngIf} or {@link ngSwitch} instead of {@link ngShow} / {@link ngHide}.
420+
* - Use the special CSS selector `ng-hide.ng-hide-animate` to set `{display: none}` or similar on the affected elements.
421+
* - Use `ng-class="{'ng-hide': expression}` instead of instead of {@link ngShow} / {@link ngHide}.
422+
* - Define an animation on the affected elements.
385423
*/
386424
var ngHideDirective = ['$animate', function($animate) {
387425
return {

0 commit comments

Comments
 (0)