Skip to content

Commit

Permalink
docs(query): 📘 simplify signal example
Browse files Browse the repository at this point in the history
  • Loading branch information
NetanelBasal committed Nov 15, 2023
1 parent 22a253a commit 6c1f2b3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 20 deletions.
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,14 @@ To get a signal use the `result` property:
@Component({
standalone: true,
template: `
@if (todos(); as result) {
@if (result.isLoading) {
<p>Loading</p>
}
@if (result.isSuccess) {
<p>{{ result.data[0].title }}</p>
}
@if (result.isError) {
<p>Error</p>
}
@if (todos().isLoading) {
Loading
}
@if (todos().data; as data) {
<p>{{ data[0].title }}</p>
}
@if (todos().isError) {
<p>Error</p>
}
`,
})
Expand Down
18 changes: 8 additions & 10 deletions src/app/basic-page/todos-page.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@ <h1>Basic Example</h1>

<h3>Signal Result</h3>
<blockquote>
@if (todos(); as result) {
@if (result.isLoading) {
<span class="loader"></span>
}
@if (result.isSuccess) {
<p>{{ result.data[0].title }}</p>
}
@if (result.isError) {
<p>Error</p>
}
@if (todos().isLoading) {
<span class="loader"></span>
}
@if (todos().data; as data) {
<p>{{ data[0].title }}</p>
}
@if (todos().isError) {
<p>Error</p>
}
</blockquote>

Expand Down

0 comments on commit 6c1f2b3

Please sign in to comment.