Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,11 @@

Deferrable views let you define content to be shown in different loading states.

<div class="docs-table docs-scroll-track-transparent">
<table>
<tr>
<td><code>@placeholder</code></td>
<td>
By default, defer blocks do not render any content before they are triggered. The <code>@placeholder</code> is an optional block that declares content to show before the deferred content loads. Angular replaces the placeholder with the deferred content after loading completes. While this block is optional, the Angular team recommends always including a placeholder.
<a href="https://angular.dev/guide/templates/defer#triggers" target="_blank">
Learn more in the full deferrable views documentation
</a>
</td>
</tr>
<tr>
<td><code>@loading</code></td>
<td>
This optional block allows you to declare content to be shown during the loading of any deferred dependencies.
</td>
</tr>
<tr>
<td><code>@error</code></td>
<td>
This block allows you to declare content which is shown if deferred loading fails.
</td>
</tr>
</table>
</div>
| Block | Description |
| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `@placeholder` | By default, defer blocks do not render any content before they are triggered. The `@placeholder` is an optional block that declares content to show before the deferred content loads. Angular replaces the placeholder with the deferred content after loading completes. While this block is optional, the Angular team recommends always including a placeholder. [Learn more in the full deferrable views documentation](guide/templates/defer) |
| `@loading` | This optional block allows you to declare content to be shown during the loading of any deferred dependencies. |
| `@error` | This block allows you to declare content which is shown if deferred loading fails. |

The contents of all the above sub-blocks are eagerly loaded. Additionally, some features require a `@placeholder` block.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,10 @@ By default, deferred content loads when the browser is idle. You can, however, c

Deferrable views offer two types of loading trigger:

<div class="docs-table docs-scroll-track-transparent">
<table>
<tr>
<td><code>on</code></td>
<td>
A trigger condition using a trigger from the list of built-in triggers.<br/>
For example: <code>@defer (on viewport)</code>
</td>
</tr>
<tr>
<td><code>when</code></td>
<td>
A condition as an expression which is evaluated for truthiness. When the expression is truthy, the placeholder is swapped with the lazily loaded content.<br/>
For example: <code>@defer (when customizedCondition)</code>
</td>
</tr>
</table>
</div>
| Trigger | Description |
| ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `on` | A trigger condition using a trigger from the list of built-in triggers.<br/>For example: `@defer (on viewport)` |
| `when` | A condition as an expression which is evaluated for truthiness. When the expression is truthy, the placeholder is swapped with the lazily loaded content.<br/>For example: `@defer (when customizedCondition)` |

If the `when` condition evaluates to `false`, the `defer` block is not reverted back to the placeholder. The swap is a one-time operation.

Expand Down
Loading