diff --git a/README.md b/README.md index d84521a..2544b51 100644 --- a/README.md +++ b/README.md @@ -121,16 +121,14 @@ To get a signal use the `result` property: @Component({ standalone: true, template: ` - @if (todos(); as result) { - @if (result.isLoading) { -

Loading

- } - @if (result.isSuccess) { -

{{ result.data[0].title }}

- } - @if (result.isError) { -

Error

- } + @if (todos().isLoading) { + Loading + } + @if (todos().data; as data) { +

{{ data[0].title }}

+ } + @if (todos().isError) { +

Error

} `, }) diff --git a/src/app/basic-page/todos-page.component.html b/src/app/basic-page/todos-page.component.html index 2dab67d..1cde2ff 100644 --- a/src/app/basic-page/todos-page.component.html +++ b/src/app/basic-page/todos-page.component.html @@ -13,16 +13,14 @@

Basic Example

Signal Result

- @if (todos(); as result) { - @if (result.isLoading) { - - } - @if (result.isSuccess) { -

{{ result.data[0].title }}

- } - @if (result.isError) { -

Error

- } + @if (todos().isLoading) { + + } + @if (todos().data; as data) { +

{{ data[0].title }}

+ } + @if (todos().isError) { +

Error

}