From 60cf72f36fb55a6df7936b26abd39560dc897fee Mon Sep 17 00:00:00 2001 From: "DESKTOP-P9VU163\\admin" Date: Wed, 18 Jun 2025 15:40:22 +0300 Subject: [PATCH] add Update the HeroesComponent template --- ...ro-detail.scss => hero-detail.component.css} | 0 src/app/hero-detail/hero-detail.component.html | 10 ++++++++++ src/app/hero-detail/hero-detail.component.ts | 17 +++++++++++++++++ src/app/hero-detail/hero-detail.html | 1 - src/app/hero-detail/hero-detail.ts | 11 ----------- src/app/heroes/heroes.component.html | 12 +++--------- src/app/heroes/heroes.component.ts | 3 ++- 7 files changed, 32 insertions(+), 22 deletions(-) rename src/app/hero-detail/{hero-detail.scss => hero-detail.component.css} (100%) create mode 100644 src/app/hero-detail/hero-detail.component.html create mode 100644 src/app/hero-detail/hero-detail.component.ts delete mode 100644 src/app/hero-detail/hero-detail.html delete mode 100644 src/app/hero-detail/hero-detail.ts diff --git a/src/app/hero-detail/hero-detail.scss b/src/app/hero-detail/hero-detail.component.css similarity index 100% rename from src/app/hero-detail/hero-detail.scss rename to src/app/hero-detail/hero-detail.component.css diff --git a/src/app/hero-detail/hero-detail.component.html b/src/app/hero-detail/hero-detail.component.html new file mode 100644 index 0000000..698c682 --- /dev/null +++ b/src/app/hero-detail/hero-detail.component.html @@ -0,0 +1,10 @@ +
+ +

{{hero.name | uppercase}} Details

+
id: {{hero.id}}
+
+ + +
+ +
\ No newline at end of file diff --git a/src/app/hero-detail/hero-detail.component.ts b/src/app/hero-detail/hero-detail.component.ts new file mode 100644 index 0000000..f1bdbb2 --- /dev/null +++ b/src/app/hero-detail/hero-detail.component.ts @@ -0,0 +1,17 @@ +import {Component, Input} from '@angular/core'; +import {FormsModule} from '@angular/forms'; +import {Hero} from '../hero'; +import {CommonModule} from '@angular/common'; + +@Component({ + standalone: true, + selector: 'app-hero-detail', + templateUrl: './hero-detail.component.html', + styleUrls: ['./hero-detail.component.css'], + imports: [CommonModule, FormsModule] +}) + +export class HeroDetailComponent { + @Input() hero?: Hero; + +} diff --git a/src/app/hero-detail/hero-detail.html b/src/app/hero-detail/hero-detail.html deleted file mode 100644 index 11ae4cc..0000000 --- a/src/app/hero-detail/hero-detail.html +++ /dev/null @@ -1 +0,0 @@ -

hero-detail works!

diff --git a/src/app/hero-detail/hero-detail.ts b/src/app/hero-detail/hero-detail.ts deleted file mode 100644 index 920aa08..0000000 --- a/src/app/hero-detail/hero-detail.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-hero-detail', - imports: [], - templateUrl: './hero-detail.html', - styleUrl: './hero-detail.scss' -}) -export class HeroDetail { - -} diff --git a/src/app/heroes/heroes.component.html b/src/app/heroes/heroes.component.html index 3e59ac1..e049c03 100644 --- a/src/app/heroes/heroes.component.html +++ b/src/app/heroes/heroes.component.html @@ -1,18 +1,12 @@

My Heroes

+ -
-

{{selectedHero.name | uppercase}} Details

-
id: {{selectedHero.id}}
-
- - -
-
\ No newline at end of file + \ No newline at end of file diff --git a/src/app/heroes/heroes.component.ts b/src/app/heroes/heroes.component.ts index 7605b06..e1ab675 100644 --- a/src/app/heroes/heroes.component.ts +++ b/src/app/heroes/heroes.component.ts @@ -3,12 +3,13 @@ import { Hero } from '../hero'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import {HEROES} from '../mock-heroes'; +import { HeroDetailComponent } from '../hero-detail/hero-detail.component'; @Component({ selector: 'app-heroes', templateUrl: './heroes.component.html', styleUrls: ['./heroes.component.css'], - imports: [CommonModule, FormsModule] + imports: [CommonModule, FormsModule, HeroDetailComponent] }) export class HeroesComponent { //определяем класс со списком героев