Fixing Angular 21 by migrating all values by signals. #11
@@ -1,8 +1,8 @@
|
|||||||
<div i18n>
|
<div i18n>
|
||||||
<span class="copy-left">©</span>
|
<span class="copy-left">©</span>
|
||||||
2016 - 2024 All rights reserved
|
2016 - 2026 All rights reserved
|
||||||
-
|
-
|
||||||
2.1
|
2.2
|
||||||
<a [routerLink]="['./']" matTooltip="Health checking will be available in future..." i18n-matTooltip>
|
<a [routerLink]="['./']" matTooltip="Health checking will be available in future..." i18n-matTooltip>
|
||||||
<mat-icon>favorite</mat-icon>
|
<mat-icon>favorite</mat-icon>
|
||||||
</a>
|
</a>
|
||||||
@@ -11,4 +11,4 @@
|
|||||||
<mat-icon matTooltip="Documentation will be available in future..." i18n-matTooltip>menu_book</mat-icon>
|
<mat-icon matTooltip="Documentation will be available in future..." i18n-matTooltip>menu_book</mat-icon>
|
||||||
-
|
-
|
||||||
<span i18n>Development realised by</span> Florian THIERRY
|
<span i18n>Development realised by</span> Florian THIERRY
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
gap: .2em;
|
||||||
|
|
||||||
.copy-left {
|
.copy-left {
|
||||||
transform: rotate(180deg);
|
transform: rotate(180deg);
|
||||||
@@ -28,4 +29,4 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,4 @@ import { RouterModule } from '@angular/router';
|
|||||||
templateUrl: './footer.component.html',
|
templateUrl: './footer.component.html',
|
||||||
styleUrl: './footer.component.scss'
|
styleUrl: './footer.component.scss'
|
||||||
})
|
})
|
||||||
export class FooterComponent {
|
export class FooterComponent {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@for(publication of publications$ | async; track publication) {
|
@for(publication of publications(); track publication.id) {
|
||||||
<a [routerLink]="['/publications/' + publication.id]" class="publication">
|
<a [routerLink]="['/publications/' + publication.id]" class="publication">
|
||||||
<img src="/api/pictures/{{ publication.illustrationId }}"/>
|
<img src="/api/pictures/{{ publication.illustrationId }}"/>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
@@ -13,4 +13,4 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Component, Input } from "@angular/core";
|
import {Component, input, Input} from "@angular/core";
|
||||||
import { Publication } from "../../core/rest-services/publications/model/publication";
|
import { Publication } from "../../core/rest-services/publications/model/publication";
|
||||||
import { Observable } from "rxjs";
|
import { Observable } from "rxjs";
|
||||||
import { CommonModule } from "@angular/common";
|
import { CommonModule } from "@angular/common";
|
||||||
@@ -12,6 +12,5 @@ import { MatTooltipModule } from "@angular/material/tooltip";
|
|||||||
imports: [CommonModule, RouterModule, MatTooltipModule]
|
imports: [CommonModule, RouterModule, MatTooltipModule]
|
||||||
})
|
})
|
||||||
export class PublicationListComponent {
|
export class PublicationListComponent {
|
||||||
@Input()
|
publications = input.required<Publication[]>();
|
||||||
publications$!: Observable<Publication[]>;
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<h1 i18n>Last publications</h1>
|
<h1 i18n>Last publications</h1>
|
||||||
@if ((isLoading$ | async) === true) {
|
@if ((isLoading())) {
|
||||||
<h2 i18n>Publications loading...</h2>
|
<h2 i18n>Publications loading...</h2>
|
||||||
<mat-spinner></mat-spinner>
|
<mat-spinner></mat-spinner>
|
||||||
} @else {
|
} @else {
|
||||||
@if ((publications$ | async) != []) {
|
@if (publications(); as publications) {
|
||||||
<app-publication-list [publications$]="publications$"></app-publication-list>
|
<app-publication-list [publications]="publications"></app-publication-list>
|
||||||
} @else {
|
} @else {
|
||||||
<h2 i18n>No any publication.</h2>
|
<h2 i18n>No any publication.</h2>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import { Component, OnInit, inject } from '@angular/core';
|
import {Component, OnInit, inject, Signal} from '@angular/core';
|
||||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { PublicationListComponent } from '../../components/publication-list/publication-list.component';
|
import { PublicationListComponent } from '../../components/publication-list/publication-list.component';
|
||||||
import { Publication } from '../../core/rest-services/publications/model/publication';
|
import { Publication } from '../../core/rest-services/publications/model/publication';
|
||||||
import { HomeService } from './home.service';
|
import { HomeService } from './home.service';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
|
import {toSignal} from "@angular/core/rxjs-interop";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-home',
|
selector: 'app-home',
|
||||||
@@ -20,12 +21,12 @@ import { CommonModule } from '@angular/common';
|
|||||||
export class HomeComponent implements OnInit {
|
export class HomeComponent implements OnInit {
|
||||||
private homeService = inject(HomeService);
|
private homeService = inject(HomeService);
|
||||||
|
|
||||||
get isLoading$(): Observable<boolean> {
|
get isLoading(): Signal<boolean> {
|
||||||
return this.homeService.isLoading$;
|
return toSignal(this.homeService.isLoading$, { initialValue: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
get publications$(): Observable<Publication[]> {
|
get publications(): Signal<Publication[]> {
|
||||||
return this.homeService.publications$;
|
return toSignal(this.homeService.publications$, { initialValue: [] });
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
|||||||
Reference in New Issue
Block a user