From e1aa5de1ff35a4b80674e12cd589f38160840ff9 Mon Sep 17 00:00:00 2001 From: rfo97 Date: Thu, 24 Apr 2025 13:17:07 +0300 Subject: [PATCH] feat: calling apis instead of static data --- src/app/app.config.ts | 4 +-- .../pet-details/pet-details.component.html | 12 +++---- .../pet-details/pet-details.component.ts | 36 +++++++++++++------ src/app/pages/pets/pets.component.ts | 23 +++++++++--- src/app/shared/services/modal.service.ts | 31 ++++++++++++++-- src/app/shared/services/pet.service.spec.ts | 16 +++++++++ src/app/shared/services/pet.service.ts | 34 ++++++++++++++++++ 7 files changed, 130 insertions(+), 26 deletions(-) create mode 100644 src/app/shared/services/pet.service.spec.ts create mode 100644 src/app/shared/services/pet.service.ts diff --git a/src/app/app.config.ts b/src/app/app.config.ts index 6c6ef60..86430cb 100644 --- a/src/app/app.config.ts +++ b/src/app/app.config.ts @@ -1,8 +1,8 @@ import { ApplicationConfig } from '@angular/core'; import { provideRouter } from '@angular/router'; - +import { provideHttpClient } from '@angular/common/http'; import { routes } from './app.routes'; export const appConfig: ApplicationConfig = { - providers: [provideRouter(routes)] + providers: [provideRouter(routes), provideHttpClient()], }; diff --git a/src/app/pages/pet-details/pet-details.component.html b/src/app/pages/pet-details/pet-details.component.html index 689c304..d07a67b 100644 --- a/src/app/pages/pet-details/pet-details.component.html +++ b/src/app/pages/pet-details/pet-details.component.html @@ -4,17 +4,17 @@ >
-

Name: {{ pet?.name }}

-

Type: {{ pet?.type }}

-

Adopted: {{ pet?.adopted ? "yes" : "no" }}

+

Name: {{ pet()?.name }}

+

Type: {{ pet()?.type }}

+

Adopted: {{ pet()?.adopted ? "yes" : "no" }}

- @if (!pet?.adopted) { + @if (!pet()?.adopted) {