1
- /* eslint-disable @angular-eslint/directive-selector */
1
+ import { TableComponent } from ' @angular-challenges/angular/di' ;
2
2
import { AsyncPipe , NgFor } from '@angular/common' ;
3
3
import { Component , Directive } from '@angular/core' ;
4
- import { TableModule } from 'primeng/table' ;
5
4
import { CurrencyPipe } from './currency.pipe' ;
6
5
import { CurrencyService } from './currency.service' ;
7
6
import { Product , products } from './product.model' ;
@@ -11,7 +10,7 @@ interface ProductContext {
11
10
}
12
11
13
12
@Directive ( {
14
- selector : 'ng-template[pTemplate="body" ]' ,
13
+ selector : 'ng-template[product ]' ,
15
14
standalone : true ,
16
15
} )
17
16
export class ProductDirective {
@@ -25,27 +24,27 @@ export class ProductDirective {
25
24
26
25
@Component ( {
27
26
standalone : true ,
28
- imports : [ TableModule , CurrencyPipe , AsyncPipe , NgFor , ProductDirective ] ,
27
+ imports : [ TableComponent , CurrencyPipe , AsyncPipe , NgFor , ProductDirective ] ,
29
28
providers : [ CurrencyService ] ,
30
29
selector : 'app-root' ,
31
30
template : `
32
- <p- table [value ]="products">
33
- <ng-template pTemplate=" header" >
31
+ <table [items ]="products">
32
+ <ng-template # header>
34
33
<tr>
35
34
<th *ngFor="let col of displayedColumns">
36
35
{{ col }}
37
36
</th>
38
37
</tr>
39
38
</ng-template>
40
- <ng-template pTemplate=" body" let-product>
39
+ <ng-template # body product let-product>
41
40
<tr>
42
41
<td>{{ product.name }}</td>
43
42
<td>{{ product.priceA | currency | async }}</td>
44
43
<td>{{ product.priceB | currency | async }}</td>
45
44
<td>{{ product.priceC | currency | async }}</td>
46
45
</tr>
47
46
</ng-template>
48
- </p- table>
47
+ </table>
49
48
` ,
50
49
} )
51
50
export class AppComponent {
0 commit comments