@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@let b = book();
|
2 |
+
|
3 |
+
<article class="book-item">
|
4 |
+
<img [src]="b.imageUrl" alt="Cover" />
|
5 |
+
<header>
|
6 |
+
<h2>{{ b.title }}</h2>
|
7 |
+
</header>
|
8 |
+
<div>
|
9 |
+
@if (b.subtitle) {
|
10 |
+
<p role="doc-subtitle">{{ b.subtitle }}</p>
|
11 |
+
}
|
12 |
+
ISBN: {{ b.isbn }}
|
13 |
+
</div>
|
14 |
+
</article>
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Component, input } from '@angular/core';
|
2 |
+
|
3 |
+
import { Book } from '../../shared/book';
|
4 |
+
|
5 |
+
@Component({
|
6 |
+
selector: 'app-book-item',
|
7 |
+
imports: [],
|
8 |
+
templateUrl: './book-item.ng.html',
|
9 |
+
styleUrl: './book-item.scss'
|
10 |
+
})
|
11 |
+
export class BookItem {
|
12 |
+
readonly book = input.required<Book>();
|
13 |
+
}
|
@@ -2,17 +2,7 @@
|
|
2 |
<h1>Books</h1>
|
3 |
<div>
|
4 |
@for (b of books(); track b.isbn) {
|
5 |
-
<
|
6 |
-
<header>
|
7 |
-
<h2>{{ b.title }}</h2>
|
8 |
-
</header>
|
9 |
-
<div>
|
10 |
-
@if (b.subtitle) {
|
11 |
-
<p role="doc-subtitle">{{ b.subtitle }}</p>
|
12 |
-
}
|
13 |
-
ISBN: {{ b.isbn }}
|
14 |
-
</div>
|
15 |
-
</article>
|
16 |
}
|
17 |
</div>
|
18 |
</section>
|
|
|
2 |
<h1>Books</h1>
|
3 |
<div>
|
4 |
@for (b of books(); track b.isbn) {
|
5 |
+
<app-book-item [book]="b" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
}
|
7 |
</div>
|
8 |
</section>
|
@@ -1,10 +1,11 @@
|
|
1 |
import { Component, signal } from '@angular/core';
|
2 |
|
3 |
import { Book } from '../../shared/book';
|
|
|
4 |
|
5 |
@Component({
|
6 |
selector: 'app-book-list',
|
7 |
-
imports: [],
|
8 |
templateUrl: './book-list.ng.html',
|
9 |
styleUrl: './book-list.scss',
|
10 |
})
|
|
|
1 |
import { Component, signal } from '@angular/core';
|
2 |
|
3 |
import { Book } from '../../shared/book';
|
4 |
+
import { BookItem } from '../book-item/book-item';
|
5 |
|
6 |
@Component({
|
7 |
selector: 'app-book-list',
|
8 |
+
imports: [BookItem],
|
9 |
templateUrl: './book-list.ng.html',
|
10 |
styleUrl: './book-list.scss',
|
11 |
})
|