added click event on keywords to navigate to keywords component

This commit is contained in:
2026-07-03 10:54:56 +02:00
parent f19059164e
commit f8228c5ea7
2 changed files with 13 additions and 5 deletions
@@ -116,9 +116,12 @@
track keyword;
let i = $index
) {
<span class="topic-chip" [ngClass]="chipColor(i)">{{
keyword
}}</span>
<span
class="topic-chip"
(click)="onKeywordClick(keyword)"
[ngClass]="chipColor(i)"
>{{ keyword }}</span
>
}
} @else {
<p class="placeholder">Keine Schlüsselwörter gefunden.</p>
@@ -6,7 +6,7 @@ import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { Router } from '@angular/router';
import { WorksService } from '../../api';
interface MentionedPerson {
@@ -45,6 +45,7 @@ export class NewsDetailComponent implements OnInit {
private readonly httpClient = inject(HttpClient);
private readonly worksService = inject(WorksService);
private readonly location = inject(Location);
private readonly router = inject(Router);
article: NewsArticleDetail | null = null;
loading = false;
@@ -70,7 +71,11 @@ export class NewsDetailComponent implements OnInit {
navigateBack(): void {
this.location.back();
}
onKeywordClick(keyword: string): void {
this.router.navigate(['/keywords'], {
queryParams: { selected: keyword, manual: keyword },
});
}
formatDate(dateStr?: string | null): string {
if (!dateStr) return '-';
const date = new Date(dateStr);