From 37cf5e4f36d6339717fc0e1c75554c92434a10b9 Mon Sep 17 00:00:00 2001 From: Samandar Date: Mon, 11 Nov 2024 14:49:07 +0500 Subject: [PATCH] convert to built-in conditionals and loops from directives --- .../app/fetch-data/fetch-data.component.html | 14 ++-- .../src/app/todo/todo.component.html | 81 ++++++++++++------- 2 files changed, 63 insertions(+), 32 deletions(-) diff --git a/src/Web/ClientApp/src/app/fetch-data/fetch-data.component.html b/src/Web/ClientApp/src/app/fetch-data/fetch-data.component.html index 6e1f57963..7ec52883d 100644 --- a/src/Web/ClientApp/src/app/fetch-data/fetch-data.component.html +++ b/src/Web/ClientApp/src/app/fetch-data/fetch-data.component.html @@ -1,10 +1,11 @@

Weather forecast

This component demonstrates fetching data from the server.

- -

Loading...

- - +@if (!forecasts?.length) { +

Loading...

+} +@else{ +
@@ -14,11 +15,14 @@

Weather forecast

- + @for (forecast of forecasts; track $index) { + + }
Date
{{ forecast.date | date }} {{ forecast.temperatureC }} {{ forecast.temperatureF }} {{ forecast.summary }}
+} \ No newline at end of file diff --git a/src/Web/ClientApp/src/app/todo/todo.component.html b/src/Web/ClientApp/src/app/todo/todo.component.html index e79b518c0..a2d279983 100644 --- a/src/Web/ClientApp/src/app/todo/todo.component.html +++ b/src/Web/ClientApp/src/app/todo/todo.component.html @@ -1,23 +1,22 @@

Todo

This is a complex todo list component.

- -

Loading...

- -
- +@if(!lists){ +

Loading...

+} +@else{ +

Lists

-
    -
  • + @for (list of lists; track $index; let i = $index) { +
  • {{ list.title }} @@ -27,9 +26,11 @@

    Lists

  • + }
-
+ @if (selectedList) { +

{{ selectedList.title }}

    -
  • + @for (item of selectedList.items; track $index;let i = $index) { +
  • - -
    + } + @else { +
    {{ item.title }}
    + }
    - + }
  • + }
+ }
- -
+} +@if(debug){ +
{{ lists | json }}
+} -
+ @if(debug){ +
{{ listOptionsEditor | json }}
+ }